# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
581775 | 2022-06-23T06:09:19 Z | 반딧불(#8365) | Sparklers (JOI17_sparklers) | C++17 | 1 ms | 212 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; int n, k; ll t; ll arr[100002]; bool able(ll speed){ speed*=t*2; int l = k, r = k; ll s = arr[k], e = arr[k]; ll len = 0; for(int cnt=1; cnt<n; cnt++){ ll lDist = arr[l] - arr[l-1]; ll rDist = arr[r+1] - arr[r]; if(min(lDist, rDist)+len > speed*cnt) return false; if(lDist < rDist) l--, len+=lDist; else r++, len+=rDist; } return true; } int main(){ scanf("%d %d %lld", &n, &k, &t); for(int i=1; i<=n; i++) scanf("%lld", &arr[i]); arr[0] = -1e18, arr[n+1] = 1e18; if(arr[1] == arr[n]){ puts("0"); return 0; } ll L = 1, R = 1e9, ANS = 1e9; while(L<=R){ ll MID = (L+R)/2; if(able(MID)) ANS = MID, R = MID-1; else L = MID+1; } printf("%lld", ANS); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Incorrect | 0 ms | 212 KB | Output isn't correct |
8 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Incorrect | 0 ms | 212 KB | Output isn't correct |
8 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Incorrect | 0 ms | 212 KB | Output isn't correct |
8 | Halted | 0 ms | 0 KB | - |