# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
27840 | 2017-07-14T07:52:52 Z | 김동현(#1158) | Sparklers (JOI17_sparklers) | C++14 | 0 ms | 2800 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; int n, k; ll x[100010], t; int can(ll v){ int l = k - 1, r = k + 1, cnt = 0; ll s = x[k], e = x[k]; for(int j = 0; j < n - 1; j++){ int c; cnt++; if(l >= 1 && e - x[l] < x[r] - s) c = l--; else c = r++; s -= v * t; e += v * t; ll ts = x[c] - v * cnt * t, te = x[c] + v * cnt * t; s = max(s, ts); e = min(e, te); if(s > e) return 0; } return 1; } int main(){ scanf("%d%d%lld", &n, &k, &t); for(int i = 1; i <= n; i++) scanf("%lld", x + i); ll s = 0, e = 2 * ((ll(1e9) + t - 1) / t); for(ll m; s <= e; ){ m = (s + e) / 2; if(can(m)) e = m - 1; else s = m + 1; } printf("%lld\n", s); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 2800 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 2800 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 2800 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |