# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
85511 | 2018-11-20T16:23:16 Z | nikolapesic2802 | Sparklers (JOI17_sparklers) | C++14 | 36 ms | 1800 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)/2; 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) { minn=1,maxx=n; if(X[minn]<X[maxx]) { le=m+1; continue; } maxx=X[1]; minn=X[n]; ok=1; while(ok) { ok=0; while(l<k&&X[l+1]>=minn) { ok=1; l++; maxx=max(maxx,X[l]); } while(r>k&&X[r-1]<=maxx) { ok=1; r--; minn=min(minn,X[r]); } } if(r==k&&l==k) { ri=m; } else { le=m+1; } } else { le=m+1; } } printf("%i\n",le); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | 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 | 3 ms | 516 KB | Output is correct |
5 | Correct | 2 ms | 516 KB | Output is correct |
6 | Correct | 2 ms | 516 KB | Output is correct |
7 | Correct | 2 ms | 540 KB | Output is correct |
8 | Correct | 2 ms | 540 KB | Output is correct |
9 | Correct | 2 ms | 552 KB | Output is correct |
10 | Correct | 2 ms | 552 KB | Output is correct |
11 | Correct | 2 ms | 552 KB | Output is correct |
12 | Correct | 2 ms | 576 KB | Output is correct |
13 | Correct | 2 ms | 580 KB | Output is correct |
14 | Correct | 2 ms | 580 KB | Output is correct |
15 | Correct | 2 ms | 580 KB | Output is correct |
16 | Correct | 2 ms | 596 KB | Output is correct |
17 | Correct | 2 ms | 596 KB | Output is correct |
18 | Correct | 2 ms | 596 KB | Output is correct |
19 | Correct | 2 ms | 596 KB | Output is correct |
20 | Correct | 2 ms | 596 KB | Output is correct |
21 | Correct | 2 ms | 596 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | 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 | 3 ms | 516 KB | Output is correct |
5 | Correct | 2 ms | 516 KB | Output is correct |
6 | Correct | 2 ms | 516 KB | Output is correct |
7 | Correct | 2 ms | 540 KB | Output is correct |
8 | Correct | 2 ms | 540 KB | Output is correct |
9 | Correct | 2 ms | 552 KB | Output is correct |
10 | Correct | 2 ms | 552 KB | Output is correct |
11 | Correct | 2 ms | 552 KB | Output is correct |
12 | Correct | 2 ms | 576 KB | Output is correct |
13 | Correct | 2 ms | 580 KB | Output is correct |
14 | Correct | 2 ms | 580 KB | Output is correct |
15 | Correct | 2 ms | 580 KB | Output is correct |
16 | Correct | 2 ms | 596 KB | Output is correct |
17 | Correct | 2 ms | 596 KB | Output is correct |
18 | Correct | 2 ms | 596 KB | Output is correct |
19 | Correct | 2 ms | 596 KB | Output is correct |
20 | Correct | 2 ms | 596 KB | Output is correct |
21 | Correct | 2 ms | 596 KB | Output is correct |
22 | Correct | 3 ms | 596 KB | Output is correct |
23 | Correct | 2 ms | 596 KB | Output is correct |
24 | Correct | 2 ms | 596 KB | Output is correct |
25 | Correct | 2 ms | 596 KB | Output is correct |
26 | Correct | 2 ms | 596 KB | Output is correct |
27 | Correct | 2 ms | 596 KB | Output is correct |
28 | Correct | 2 ms | 596 KB | Output is correct |
29 | Correct | 2 ms | 596 KB | Output is correct |
30 | Correct | 3 ms | 596 KB | Output is correct |
31 | Correct | 2 ms | 636 KB | Output is correct |
32 | Correct | 2 ms | 636 KB | Output is correct |
33 | Correct | 3 ms | 636 KB | Output is correct |
34 | Correct | 2 ms | 636 KB | Output is correct |
35 | Correct | 2 ms | 636 KB | Output is correct |
36 | Correct | 2 ms | 636 KB | Output is correct |
37 | Correct | 2 ms | 636 KB | Output is correct |
38 | Correct | 2 ms | 636 KB | Output is correct |
39 | Correct | 2 ms | 636 KB | Output is correct |
40 | Correct | 2 ms | 636 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | 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 | 3 ms | 516 KB | Output is correct |
5 | Correct | 2 ms | 516 KB | Output is correct |
6 | Correct | 2 ms | 516 KB | Output is correct |
7 | Correct | 2 ms | 540 KB | Output is correct |
8 | Correct | 2 ms | 540 KB | Output is correct |
9 | Correct | 2 ms | 552 KB | Output is correct |
10 | Correct | 2 ms | 552 KB | Output is correct |
11 | Correct | 2 ms | 552 KB | Output is correct |
12 | Correct | 2 ms | 576 KB | Output is correct |
13 | Correct | 2 ms | 580 KB | Output is correct |
14 | Correct | 2 ms | 580 KB | Output is correct |
15 | Correct | 2 ms | 580 KB | Output is correct |
16 | Correct | 2 ms | 596 KB | Output is correct |
17 | Correct | 2 ms | 596 KB | Output is correct |
18 | Correct | 2 ms | 596 KB | Output is correct |
19 | Correct | 2 ms | 596 KB | Output is correct |
20 | Correct | 2 ms | 596 KB | Output is correct |
21 | Correct | 2 ms | 596 KB | Output is correct |
22 | Correct | 3 ms | 596 KB | Output is correct |
23 | Correct | 2 ms | 596 KB | Output is correct |
24 | Correct | 2 ms | 596 KB | Output is correct |
25 | Correct | 2 ms | 596 KB | Output is correct |
26 | Correct | 2 ms | 596 KB | Output is correct |
27 | Correct | 2 ms | 596 KB | Output is correct |
28 | Correct | 2 ms | 596 KB | Output is correct |
29 | Correct | 2 ms | 596 KB | Output is correct |
30 | Correct | 3 ms | 596 KB | Output is correct |
31 | Correct | 2 ms | 636 KB | Output is correct |
32 | Correct | 2 ms | 636 KB | Output is correct |
33 | Correct | 3 ms | 636 KB | Output is correct |
34 | Correct | 2 ms | 636 KB | Output is correct |
35 | Correct | 2 ms | 636 KB | Output is correct |
36 | Correct | 2 ms | 636 KB | Output is correct |
37 | Correct | 2 ms | 636 KB | Output is correct |
38 | Correct | 2 ms | 636 KB | Output is correct |
39 | Correct | 2 ms | 636 KB | Output is correct |
40 | Correct | 2 ms | 636 KB | Output is correct |
41 | Correct | 20 ms | 1280 KB | Output is correct |
42 | Correct | 3 ms | 1280 KB | Output is correct |
43 | Correct | 8 ms | 1280 KB | Output is correct |
44 | Correct | 30 ms | 1788 KB | Output is correct |
45 | Correct | 28 ms | 1788 KB | Output is correct |
46 | Correct | 30 ms | 1800 KB | Output is correct |
47 | Correct | 35 ms | 1800 KB | Output is correct |
48 | Correct | 34 ms | 1800 KB | Output is correct |
49 | Correct | 30 ms | 1800 KB | Output is correct |
50 | Correct | 36 ms | 1800 KB | Output is correct |
51 | Correct | 30 ms | 1800 KB | Output is correct |
52 | Correct | 29 ms | 1800 KB | Output is correct |
53 | Correct | 36 ms | 1800 KB | Output is correct |
54 | Correct | 29 ms | 1800 KB | Output is correct |
55 | Correct | 30 ms | 1800 KB | Output is correct |
56 | Correct | 30 ms | 1800 KB | Output is correct |
57 | Correct | 32 ms | 1800 KB | Output is correct |
58 | Correct | 30 ms | 1800 KB | Output is correct |
59 | Correct | 22 ms | 1800 KB | Output is correct |
60 | Correct | 30 ms | 1800 KB | Output is correct |
61 | Correct | 28 ms | 1800 KB | Output is correct |
62 | Correct | 28 ms | 1800 KB | Output is correct |
63 | Correct | 32 ms | 1800 KB | Output is correct |
64 | Correct | 34 ms | 1800 KB | Output is correct |
65 | Correct | 30 ms | 1800 KB | Output is correct |
66 | Correct | 27 ms | 1800 KB | Output is correct |
67 | Correct | 33 ms | 1800 KB | Output is correct |
68 | Correct | 34 ms | 1800 KB | Output is correct |
69 | Correct | 29 ms | 1800 KB | Output is correct |