# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
131459 | 2019-07-17T07:28:50 Z | 임유진(#3181) | Sparklers (JOI17_sparklers) | C++14 | 2 ms | 380 KB |
#include <bits/stdc++.h> using namespace std; #define MAXN 100005 typedef long long lint; lint X[MAXN]; lint di(lint a, lint b) { return a == 0 ? 0ll : ((a - 1) / b + 1); } int main() { int N, K; lint T; scanf("%d%d%lld", &N, &K, &T); for(int i = 1; i <= N; i++) scanf("%lld", X + i); vector<lint> v1, v2; for(int i = 1; i < K; i++) v1.push_back(X[i + 1] - X[i]); for(int i = N; i > K; i--) v2.push_back(X[i] - X[i - 1]); lint S = 0ll; int cnt = 0; lint ti = 0ll; while(!v1.empty() || !v2.empty()) { if(v2.empty() || (!v1.empty() && v1.back() < v2.back())) { ti += v1.back(); v1.pop_back(); } else { ti += v2.back(); v2.pop_back(); } cnt++; if(ti > 0) S = max(S, di(ti, 2 * T * cnt)); } printf("%lld", S); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 380 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Incorrect | 2 ms | 376 KB | Output isn't correct |
8 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 380 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Incorrect | 2 ms | 376 KB | Output isn't correct |
8 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 380 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Incorrect | 2 ms | 376 KB | Output isn't correct |
8 | Halted | 0 ms | 0 KB | - |