跳到正文

题解

【题解】 AT3670 [ARC085A] HSI 题解

Heliox约 1 分钟
原文
文章信息与版本

文章信息

发布
2022年2月16日
收录
2026年10月14日
更新
2026年11月17日
篇幅
约 1 分钟
获赞
5

版本

  1. v1当前

我们首先要明确:总耗时 == 期望提交次数 ×\times 每次等待时间。

其中每次等待的时间为 1900m+100×(n−m)=1800m+100n1900m+100 \times (n - m) = 1800m + 100n。

其中 mm 个测试点,每个测试点 AC 的概率为 12\frac{1}{2},那么 AC 率就是 (12)m=12m(\frac{1}{2})^m=\frac{1}{2^m},期望提交次数为 2m2^m。

根据上面的公式,我们可得总耗时为 2m×(1800m+100n)2^m \times (1800m + 100n)。

可得以下 O(n)O(n) 复杂度的代码:

C++
#include <iostream>
#include <cmath>
using namespace std;

int main()
{
    int n; cin >> n;
    int m; cin >> m;
    cout << (pow(2, m) * (1800 * m + 100 * n));
    return 0;
}