제출 #1130325

#제출 시각아이디문제언어결과실행 시간메모리
1130325juliany2Sparklers (JOI17_sparklers)C++20
0 / 100
0 ms328 KiB
#include<bits/stdc++.h> using namespace std; using ll = long long; #define all(x) (x).begin(), (x).end() const int N = 1e3 + 7; int n, k; ll t, a[N]; ll cdiv(ll x, ll y) { if (y == 0) return 0; return (x + y - 1) / y; } int main() { cin.tie(0)->sync_with_stdio(false); cin >> n >> k >> t; for (int i = 1; i <= n; i++) cin >> a[i]; a[0] = -1e18, a[n + 1] = 1e18; ll ans = 0; int l = k, r = k; for (int i = 1; i < n; i++) { ll x = cdiv(a[r] - a[l - 1], 2 * t * i); ll y = cdiv(a[r + 1] - a[l], 2 * t * i); if (x < y) { l--; ans = max(ans, x); } else { r++; ans = max(ans, y); } } cout << ans << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...