# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
932762 | 2024-02-24T07:11:22 Z | Sharky | Cell Automaton (JOI23_cell) | C++17 | 108 ms | 14396 KB |
#include <bits/stdc++.h> using namespace std; #define int long long int32_t main() { ios::sync_with_stdio(0); cin.tie(0); int n, q; cin >> n >> q; vector<int> a(n), d; for (int i = 0; i < n; i++) { cin >> a[i] >> a[i]; } sort(a.begin(), a.end()); for (int i = 1; i < n; i++) d.push_back(a[i] - a[i - 1]); int pt = 0, sum = 0; sort(d.begin(), d.end()); while (q--) { int t; cin >> t; if (t == 0) { cout << n << '\n'; continue; } int cnt = 0, prv = pt; while (pt < d.size() && d[pt] < t) sum += d[pt], pt++; while (pt < d.size() && d[pt] == t) sum += d[pt], cnt++, pt++; cout << sum * 2 + 4 * (n - pt) * t + cnt * (t - 1) << '\n'; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 28 ms | 2268 KB | Output is correct |
2 | Correct | 30 ms | 4316 KB | Output is correct |
3 | Correct | 30 ms | 4316 KB | Output is correct |
4 | Correct | 29 ms | 4316 KB | Output is correct |
5 | Correct | 29 ms | 4304 KB | Output is correct |
6 | Correct | 30 ms | 4428 KB | Output is correct |
7 | Correct | 32 ms | 4312 KB | Output is correct |
8 | Correct | 1 ms | 344 KB | Output is correct |
9 | Correct | 0 ms | 360 KB | Output is correct |
10 | Correct | 1 ms | 348 KB | Output is correct |
11 | Correct | 29 ms | 4308 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 28 ms | 2268 KB | Output is correct |
2 | Correct | 30 ms | 4316 KB | Output is correct |
3 | Correct | 30 ms | 4316 KB | Output is correct |
4 | Correct | 29 ms | 4316 KB | Output is correct |
5 | Correct | 29 ms | 4304 KB | Output is correct |
6 | Correct | 30 ms | 4428 KB | Output is correct |
7 | Correct | 32 ms | 4312 KB | Output is correct |
8 | Correct | 1 ms | 344 KB | Output is correct |
9 | Correct | 0 ms | 360 KB | Output is correct |
10 | Correct | 1 ms | 348 KB | Output is correct |
11 | Correct | 29 ms | 4308 KB | Output is correct |
12 | Correct | 108 ms | 14140 KB | Output is correct |
13 | Correct | 98 ms | 14188 KB | Output is correct |
14 | Correct | 104 ms | 14284 KB | Output is correct |
15 | Correct | 100 ms | 14080 KB | Output is correct |
16 | Correct | 63 ms | 7288 KB | Output is correct |
17 | Correct | 62 ms | 7248 KB | Output is correct |
18 | Correct | 70 ms | 10580 KB | Output is correct |
19 | Correct | 102 ms | 14396 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |