# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
275657 | 2020-08-20T06:57:16 Z | 반딧불(#5115) | Circus (Balkan15_CIRCUS) | C++17 | 4000 ms | 10628 KB |
#include <bits/stdc++.h> #include "circus.h" using namespace std; typedef long long ll; int n, m; int arr[100002]; int DP[100002]; bool visited[100002]; void init(int N, int M, int P[]){ n = N, m = M; for(int i=1; i<=n; i++) arr[i] = P[i-1]; sort(arr+1, arr+n+1); arr[++n] = m; for(int i=1; i<n; i++) DP[i] = 2e9; for(int cnt = 1; cnt <= n; cnt++){ int minVal = INT_MAX, minIdx = 0; for(int i=1; i<=n; i++) if(!visited[i] && minVal > DP[i]) minVal = DP[i], minIdx = i; visited[minIdx] = 1; for(int i=1; i<=n; i++){ if(visited[i]) continue; if(abs(arr[i] - arr[minIdx]) >= minVal) DP[i] = min(DP[i], abs(arr[i] - arr[minIdx])); } } // for(int i=1; i<=n; i++) printf("%d ", DP[i]); } int minLength(int x){ int ans = INT_MAX; for(int i=1; i<=n; i++) if(abs(x - arr[i]) >= DP[i]) ans = min(ans, abs(x - arr[i])); return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4027 ms | 2320 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 384 KB | Output is correct |
3 | Correct | 0 ms | 384 KB | Output is correct |
4 | Correct | 1 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 384 KB | Output is correct |
3 | Correct | 0 ms | 384 KB | Output is correct |
4 | Correct | 1 ms | 384 KB | Output is correct |
5 | Correct | 17 ms | 384 KB | Output is correct |
6 | Correct | 16 ms | 384 KB | Output is correct |
7 | Correct | 20 ms | 384 KB | Output is correct |
8 | Correct | 15 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 384 KB | Output is correct |
3 | Correct | 0 ms | 384 KB | Output is correct |
4 | Correct | 1 ms | 384 KB | Output is correct |
5 | Correct | 17 ms | 384 KB | Output is correct |
6 | Correct | 16 ms | 384 KB | Output is correct |
7 | Correct | 20 ms | 384 KB | Output is correct |
8 | Correct | 15 ms | 384 KB | Output is correct |
9 | Correct | 3133 ms | 10304 KB | Output is correct |
10 | Correct | 3153 ms | 8068 KB | Output is correct |
11 | Correct | 3309 ms | 7620 KB | Output is correct |
12 | Correct | 3366 ms | 10628 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4027 ms | 2320 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4027 ms | 2320 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |