# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
581755 | 2022-06-23T05:48:45 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
# | 결과 | 실행 시간 | 메모리 | 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 | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Incorrect | 1 ms | 212 KB | Output isn't correct |
8 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | 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 | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Incorrect | 1 ms | 212 KB | Output isn't correct |
8 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | 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 | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Incorrect | 1 ms | 212 KB | Output isn't correct |
8 | Halted | 0 ms | 0 KB | - |