# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
971759 | 2024-04-29T09:01:41 Z | nguyentunglam | Measures (CEOI22_measures) | C++17 | 1500 ms | 3640 KB |
#include<bits/stdc++.h> #define all(v) v.begin(), v.end() #define endl "\n" using namespace std; const int N = 2e5 + 30; int n, m, d; long long a[N]; int32_t main() { #define task "" cin.tie(0) -> sync_with_stdio(0); if (fopen("task.inp", "r")) { freopen("task.inp", "r", stdin); freopen("task.out", "w", stdout); } if (fopen(task".inp", "r")) { freopen (task".inp", "r", stdin); freopen (task".out", "w", stdout); } cin >> n >> m >> d; for(int i = 1; i <= n; i++) cin >> a[i]; auto calc = [&] () { sort(a + 1, a + n + 1); long long ans = 0; for(int i = 1; i <= n; i++) for(int j = i + 1; j <= n; j++) { ans = max(ans, 1LL * (j - i) * d - a[j] + a[i]); } return ans; }; while (m--) { ++n; cin >> a[n]; long long ret = calc(); cout << ret / 2; if (ret % 2) cout << ".5"; cout << " "; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 20 ms | 348 KB | Output is correct |
2 | Correct | 19 ms | 348 KB | Output is correct |
3 | Correct | 20 ms | 476 KB | Output is correct |
4 | Correct | 20 ms | 348 KB | Output is correct |
5 | Correct | 19 ms | 348 KB | Output is correct |
6 | Correct | 20 ms | 480 KB | Output is correct |
7 | Correct | 20 ms | 348 KB | Output is correct |
8 | Correct | 19 ms | 344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 20 ms | 348 KB | Output is correct |
2 | Correct | 19 ms | 348 KB | Output is correct |
3 | Correct | 20 ms | 476 KB | Output is correct |
4 | Correct | 20 ms | 348 KB | Output is correct |
5 | Correct | 19 ms | 348 KB | Output is correct |
6 | Correct | 20 ms | 480 KB | Output is correct |
7 | Correct | 20 ms | 348 KB | Output is correct |
8 | Correct | 19 ms | 344 KB | Output is correct |
9 | Execution timed out | 1593 ms | 3640 KB | Time limit exceeded |
10 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1548 ms | 464 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1548 ms | 464 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |