# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
646070 | 2022-09-28T14:48:02 Z | eNGy | Circus (Balkan15_CIRCUS) | C++17 | 10 ms | 2000 KB |
#include "circus.h" #include <bits/stdc++.h> #define c(x) (cerr << __LINE__ << ": " << #x << ' ' << (x) << endl, (x)) #define vis() (cerr << __LINE__ << endl) #define ll long long #define f first #define s second #define pb push_back #define rsz resize #define all(x) begin(x), end(x) #define sz(x) (int)(x).size() using namespace std; vector<int> X; int n; bool possible(int D, int l){ while(l != 0 && D != X[n]){ int d = *(upper_bound(X.begin(), X.end(), D + l) - 1); l = d - D; D = d; } return (D == X[n]); } void init(int N, int M, int P[]){ n = N; for(int i=0; i<N; i++){ X.pb(P[i]); } X.pb(M); } int minLength(int D) { int start = distance(X.begin(), upper_bound(X.begin(), X.end(), D)); int I = start, F = n; if(possible(D, abs(D - X[I]))){ return abs(D - X[I]); } while(I != F-1){ int M = (I+F)/2; if(possible(D, abs(X[M] - D))){ F = M; }else{ I = M; } } return abs(D - X[F]); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 10 ms | 2000 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 10 ms | 2000 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 10 ms | 2000 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |