# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
59784 |
2018-07-23T06:10:13 Z |
윤교준(#1726) |
Sparklers (JOI17_sparklers) |
C++11 |
|
3 ms |
604 KB |
#include <bits/stdc++.h>
#define pb push_back
#define eb emplace_back
#define allv(V) ((V).begin()),((V).end())
#define sorv(V) sort(allv(V))
#define univ(V) (V).erase(unique(allv(V)),(V).end())
#define sz(V) ((int)(V).size())
#define upmin(a,b) (a)=min((a),(b))
#define upmax(a,b) (a)=max((a),(b))
#define INF (0x3f3f3f3f)
#define INFLL (0x3f3f3f3f3f3f3f3fll)
using namespace std;
typedef long long ll;
const int MAXN = 100005;
int A[MAXN];
int N, K, T;
bool isp(int P) {
int i = K, j = K;
for(; 1 < i || j < N;) {
if(1 < i && ll(A[j]) - 2ll * P * T * j <= ll(A[i-1]) - 2ll * P * T * (i-1)) i--;
else if(j < N && ll(A[j+1]) - 2ll * P * T * (j+1) <= ll(A[i]) - 2ll * P * T * i) j++;
else break;
}
return 1 == i && j == N;
}
int getAns() {
int s = 1, e = INF/T+2; for(int m; s < e;) {
m = (s+e) >> 1;
if(isp(m)) e = m;
else s = m+1;
}
return s;
}
int main() {
ios::sync_with_stdio(false);
cin >> N >> K >> T;
for(int i = 1; i <= N; i++) cin >> A[i];
cout << getAns() << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
380 KB |
Output is correct |
2 |
Correct |
3 ms |
380 KB |
Output is correct |
3 |
Correct |
3 ms |
604 KB |
Output is correct |
4 |
Correct |
2 ms |
604 KB |
Output is correct |
5 |
Correct |
3 ms |
604 KB |
Output is correct |
6 |
Correct |
3 ms |
604 KB |
Output is correct |
7 |
Incorrect |
3 ms |
604 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
380 KB |
Output is correct |
2 |
Correct |
3 ms |
380 KB |
Output is correct |
3 |
Correct |
3 ms |
604 KB |
Output is correct |
4 |
Correct |
2 ms |
604 KB |
Output is correct |
5 |
Correct |
3 ms |
604 KB |
Output is correct |
6 |
Correct |
3 ms |
604 KB |
Output is correct |
7 |
Incorrect |
3 ms |
604 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
380 KB |
Output is correct |
2 |
Correct |
3 ms |
380 KB |
Output is correct |
3 |
Correct |
3 ms |
604 KB |
Output is correct |
4 |
Correct |
2 ms |
604 KB |
Output is correct |
5 |
Correct |
3 ms |
604 KB |
Output is correct |
6 |
Correct |
3 ms |
604 KB |
Output is correct |
7 |
Incorrect |
3 ms |
604 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |