QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#606420#9220. Bus AnalysismaxplusWA 1ms3696kbC++201.3kb2024-10-03 06:03:372024-10-03 06:03:37

Judging History

你现在查看的是最新测评结果

  • [2024-10-03 06:03:37]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3696kb
  • [2024-10-03 06:03:37]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

constexpr int N = 1e3 + 1, mod = 1e9 + 7;

int c[N], d[N], t[N], p2[N];

int main() {
  cin.tie(0)->sync_with_stdio(0);
  int n; cin >> n;
  for (int i = 0; i < n; ++i) cin >> t[i];
  for (int i = 0, f = 1; i < n; ++i) p2[i] = f, f = f * 2 % mod;
  t[n] = 2e9;
  c[0] = 1;
  for (int i = 0; i < n; ++i) {
    c[i + 1] += c[i];
    d[i + 1] += d[i];
    auto skip = [&](int i, int d) { int j = i; while (j < n && t[j] < t[i] + d) ++j; return j; };
    int ii = skip(i, 20), iii = skip(i, 75);
    for (int j = ii; j <= n; ++j) {
      if (t[j] >= t[i] + 35) {
        c[j] = (c[j] + c[i] * 1ull * p2[ii - i - 1]) % mod;
        d[j] = (d[j] + d[i] * 1ull * p2[ii - i - 1] + c[i] * 2ull * p2[ii - i - 1]) % mod;
        break;
      }
      int jj = skip(j, 20);
      for (int k = jj; k <= n; ++k) {
        if (t[k] >= t[i] + 55) {
          c[k] = (c[k] + c[i] * 1ull * p2[ii - i + jj - j - 2]) % mod;
          d[k] = (d[k] + d[i] * 1ull * p2[ii - i + jj - j - 2] + c[i] * 4ull * p2[ii - i + jj - j - 2]) % mod;
          break;
        }
        c[iii] = (c[iii] + c[i] * 1ull * p2[ii - i + jj - j + iii - k - 3]) % mod;
        d[iii] = (d[iii] + d[i] * 1ull * p2[ii - i + jj - j + iii - k - 3] + c[i] * 6ull * p2[ii - i + jj - j + iii - k - 3]) % mod;
      }
    }
  }
  cout << d[n];
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3692kb

input:

3
1 8 20

output:

14

result:

ok 1 number(s): "14"

Test #2:

score: 0
Accepted
time: 1ms
memory: 3616kb

input:

5
25 45 65 85 1000000000

output:

156

result:

ok 1 number(s): "156"

Test #3:

score: -100
Wrong Answer
time: 1ms
memory: 3696kb

input:

1000
2 7 9 12 14 17 18 21 22 28 29 33 34 35 37 38 44 45 46 50 58 59 63 66 71 72 75 76 77 78 80 81 83 84 87 92 100 101 107 108 109 112 114 116 118 123 124 131 142 143 144 145 148 150 151 152 153 155 157 158 165 167 168 169 171 176 182 185 190 192 198 202 204 205 212 213 223 224 225 226 229 231 240 24...

output:

293770920

result:

wrong answer 1st numbers differ - expected: '932594593', found: '293770920'