# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
85407 | 2018-11-19T19:24:44 Z | nikolapesic2802 | Sparklers (JOI17_sparklers) | C++14 | 2 ms | 252 KB |
#include <bits/stdc++.h> #define ll long long #define pb push_back #define sz(x) (int)(x).size() #define mp make_pair #define f first #define s second #define all(x) x.begin(), x.end() using namespace std; int main() { int n,k,t; scanf("%i %i %i",&n,&k,&t); vector<int> arr(n+1); for(int i=1;i<=n;i++) { scanf("%i",&arr[i]); } int le=0,ri=1e9; while(le<ri) { int m=(le+ri)>>1; vector<long double> X(n+1); for(int i=1;i<=n;i++) { X[i]=arr[i]-(long double)2*m*t*(i-1); } int l=k,r=k; int minn=k,maxx=k; int ok=1; while(ok) { ok=0; while(l>1&&X[l-1]>=X[minn]) { ok=1; if(X[--l]>X[maxx])maxx=l; } while(r<n&&X[r+1]<=X[maxx]) { ok=1; if(X[++r]<X[minn])minn=r; } } if(l==1&&r==n) { l=1,r=n; minn=1,maxx=n; ok=1; while(ok) { ok=0; while(l<k&&X[l+1]>=X[minn]) { ok=1; if(X[++l]>X[maxx])maxx=l; } while(r>k&&X[r-1]<=X[maxx]) { ok=1; if(X[--r]<X[minn])minn=r; } } if(l==r&&l==k) { ri=m; } else { le=m+1; } } else { le=m+1; } } printf("%i\n",le); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 252 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 252 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 252 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |