long long solve(int N, int K, int *A, int *B) {
long long ans = 0;
bool ok[N] = {};
for(int q = 0; q < N; q++) {
long long now = ans;
for(int i = 0; i < N; i++) {
long long sum = 0;
if(ok[i] == 1) continue;
for(int j = 0; j < K; j++) {
sum += B[(i+j)%N];
}
if(sum < A[i]) {
ok[i] = 1;
ans += A[i]-sum;
for(int j = 0; j < K; j++) {
B[(i+j)%N] = 0;}
}
}
if(now == ans) break;
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
117 ms |
4696 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |