# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1047302 | 2024-08-07T11:52:33 Z | PanosPask | Circus (Balkan15_CIRCUS) | C++14 | 1801 ms | 524288 KB |
#include <bits/stdc++.h> #include "circus.h" #define mp make_pair using namespace std; typedef pair<int, int> pi; int N, M; vector<int> p; vector<int> dist; void init(int n, int m, int P[]){ N = n; M = m; p.resize(N); dist.resize(N); for (int i = 0; i < N; i++) { p[i] = P[i]; } sort(p.begin(), p.end()); priority_queue<pi, vector<pi>, greater<pi>> q; for (int i = 0; i < N; i++) { dist[i] = M - p[i]; q.push(mp(dist[i], i)); } while (!q.empty()) { int i, d; tie(d, i) = q.top(); q.pop(); if (dist[i] < d) { continue; } for (int j = 0; j < N; j++) { if (abs(p[j] - p[i]) >= dist[i] && dist[j] > abs(p[j] - p[i])) { dist[j] = abs(p[j] - p[i]); q.push(mp(dist[j], j)); } } } } int minLength(int D) { int ans = M - D; for (int i = 0; i < N; i++) { if (abs(D - p[i]) >= dist[i]) { ans = min(ans, abs(D - p[i])); } } return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1333 ms | 524288 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 25 ms | 2512 KB | Output is correct |
6 | Correct | 44 ms | 6232 KB | Output is correct |
7 | Correct | 26 ms | 2508 KB | Output is correct |
8 | Correct | 22 ms | 2512 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 25 ms | 2512 KB | Output is correct |
6 | Correct | 44 ms | 6232 KB | Output is correct |
7 | Correct | 26 ms | 2508 KB | Output is correct |
8 | Correct | 22 ms | 2512 KB | Output is correct |
9 | Correct | 1801 ms | 17884 KB | Output is correct |
10 | Correct | 1771 ms | 10672 KB | Output is correct |
11 | Correct | 1728 ms | 10108 KB | Output is correct |
12 | Correct | 1709 ms | 18864 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1333 ms | 524288 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1333 ms | 524288 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |