# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1047302 | PanosPask | Circus (Balkan15_CIRCUS) | C++14 | 1801 ms | 524288 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |