#include <bits/stdc++.h>
#include "homecoming.h"
using namespace std;
typedef long long LL;
long long solve(int N, int K, int *A, int *B){
int ok=1,res=0;
int *vis = new int[N];
for(int i=0;i<N;i++)
vis[i]=1;
while(ok){
ok=0;
for(int i=0;i<N;i++)
if(vis[i]){
int sum=0;
for(int j=i;j<i+K;j++)
sum+=B[j];
if(sum<=A[i]){
ok=1;
vis[i]=0;
res+=(A[i]-sum);
for(int j=i;j<i+K;j++)
B[j]=0;
}
}
}
return res;
}
/*int main() {
int T; assert(scanf("%d", &T) == 1);
for(int t = 0; t < T; t++) {
int N, K; assert(scanf("%d%d", &N, &K) == 2);
int *A = new int[N];
int *B = new int[N];
for(int i = 0; i < N; i++) assert(scanf("%d", &A[i]) == 1);
for(int i = 0; i < N; i++) assert(scanf("%d", &B[i]) == 1);
printf("%lld\n", solve(N, K, A, B));
delete[] A;
delete[] B;
}
return 0;
}
*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
3 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
3 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
86 ms |
6520 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
3 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |