# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
85400 | 2018-11-19T19:10:18 Z | nikolapesic2802 | Sparklers (JOI17_sparklers) | C++14 | 2 ms | 608 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 l1=0,r1=1e9; while(l1<r1) { int m=(l1+r1)>>1; vector<ll> X(n+1); for(int i=1;i<=n;i++) { X[i]=arr[i]-(ll)2*m*t*(i-1); } int l=k,r=k; ll minn=X[k],maxx=X[k]; int ok=1; while(ok) { ok=0; while(l>1&&X[l-1]>=minn) { ok=1; l--; maxx=max(maxx,X[l]); } while(r<n&&X[r+1]<=maxx) { ok=1; r++; minn=min(minn,X[r]); } } if(l==1&&r==n) { r1=m; } else { l1=m+1; } } printf("%i\n",l1); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 500 KB | Output is correct |
3 | Correct | 2 ms | 500 KB | Output is correct |
4 | Correct | 2 ms | 500 KB | Output is correct |
5 | Correct | 2 ms | 500 KB | Output is correct |
6 | Correct | 2 ms | 500 KB | Output is correct |
7 | Correct | 2 ms | 508 KB | Output is correct |
8 | Correct | 2 ms | 508 KB | Output is correct |
9 | Correct | 2 ms | 508 KB | Output is correct |
10 | Correct | 2 ms | 540 KB | Output is correct |
11 | Correct | 2 ms | 588 KB | Output is correct |
12 | Incorrect | 2 ms | 608 KB | Output isn't correct |
13 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 500 KB | Output is correct |
3 | Correct | 2 ms | 500 KB | Output is correct |
4 | Correct | 2 ms | 500 KB | Output is correct |
5 | Correct | 2 ms | 500 KB | Output is correct |
6 | Correct | 2 ms | 500 KB | Output is correct |
7 | Correct | 2 ms | 508 KB | Output is correct |
8 | Correct | 2 ms | 508 KB | Output is correct |
9 | Correct | 2 ms | 508 KB | Output is correct |
10 | Correct | 2 ms | 540 KB | Output is correct |
11 | Correct | 2 ms | 588 KB | Output is correct |
12 | Incorrect | 2 ms | 608 KB | Output isn't correct |
13 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 500 KB | Output is correct |
3 | Correct | 2 ms | 500 KB | Output is correct |
4 | Correct | 2 ms | 500 KB | Output is correct |
5 | Correct | 2 ms | 500 KB | Output is correct |
6 | Correct | 2 ms | 500 KB | Output is correct |
7 | Correct | 2 ms | 508 KB | Output is correct |
8 | Correct | 2 ms | 508 KB | Output is correct |
9 | Correct | 2 ms | 508 KB | Output is correct |
10 | Correct | 2 ms | 540 KB | Output is correct |
11 | Correct | 2 ms | 588 KB | Output is correct |
12 | Incorrect | 2 ms | 608 KB | Output isn't correct |
13 | Halted | 0 ms | 0 KB | - |