Submission #63548

# Submission time Handle Problem Language Result Execution time Memory
63548 2018-08-02T06:22:27 Z kylych03 Homecoming (BOI18_homecoming) C++14
0 / 100
1000 ms 4324 KB
#include <bits/stdc++.h>
using namespace std;
long long solve(int N, int K, int *A, int *B){
	int ok=1;
	long long 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++)
			{
				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;	
}
# Verdict Execution time Memory Grader output
1 Execution timed out 1065 ms 248 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1065 ms 248 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1088 ms 4324 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1065 ms 248 KB Time limit exceeded
2 Halted 0 ms 0 KB -