# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
27844 | 2017-07-14T08:02:59 Z | 김현수(#1159) | Sparklers (JOI17_sparklers) | C++14 | 0 ms | 2800 KB |
#include<bits/stdc++.h> using namespace std; typedef long long ll; const ll N = 100005, inf = 1e9; ll n, k, t, a[N]; bool can (ll P) { ll S = k, E = k, C = 0; for(ll i=1;i<n;i++) { if(a[S]-a[S-1] < a[E+1]-a[E]) { C += a[S]-a[S-1]; S--; } else {C += a[E+1]-a[E]; E++;} if(i*t*P*2 < C) return false; } return true; } int main() { scanf("%lld%lld%lld",&n,&k,&t); bool f = false; for(ll i=1;i<=n;i++) { scanf("%lld",&a[i]); if(a[i] != a[i-1]) f = true; } if(!f) {puts("0"); return 0;} a[0] = -2*inf; a[n+1] = 2*inf; ll S = 1, E = inf; while(S<E) { ll M = (S+E)/2; can(M) ? E = M : S = M+1; } printf("%lld\n",S); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2800 KB | Output is correct |
2 | Correct | 0 ms | 2800 KB | Output is correct |
3 | Correct | 0 ms | 2800 KB | Output is correct |
4 | Correct | 0 ms | 2800 KB | Output is correct |
5 | Correct | 0 ms | 2800 KB | Output is correct |
6 | Correct | 0 ms | 2800 KB | Output is correct |
7 | Incorrect | 0 ms | 2800 KB | Output isn't correct |
8 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2800 KB | Output is correct |
2 | Correct | 0 ms | 2800 KB | Output is correct |
3 | Correct | 0 ms | 2800 KB | Output is correct |
4 | Correct | 0 ms | 2800 KB | Output is correct |
5 | Correct | 0 ms | 2800 KB | Output is correct |
6 | Correct | 0 ms | 2800 KB | Output is correct |
7 | Incorrect | 0 ms | 2800 KB | Output isn't correct |
8 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2800 KB | Output is correct |
2 | Correct | 0 ms | 2800 KB | Output is correct |
3 | Correct | 0 ms | 2800 KB | Output is correct |
4 | Correct | 0 ms | 2800 KB | Output is correct |
5 | Correct | 0 ms | 2800 KB | Output is correct |
6 | Correct | 0 ms | 2800 KB | Output is correct |
7 | Incorrect | 0 ms | 2800 KB | Output isn't correct |
8 | Halted | 0 ms | 0 KB | - |