Submission #253548

# Submission time Handle Problem Language Result Execution time Memory
253548 2020-07-28T08:02:18 Z nandonathaniel Timovi (COCI18_timovi) C++14
60 / 80
1000 ms 2172 KB
#include<bits/stdc++.h>
using namespace std;

int a[200005];

int main(){
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	int n,k,m,sisa;
	cin >> n >> k >> m;
	sisa=m;
	while(true){
		for(int i=1;i<=n;i++){
			if(sisa==0)break;
			a[i]+=min(k,sisa);
			sisa-=min(k,sisa);
		}
		if(!sisa)break;
		for(int i=n-1;i>=2;i--){
			if(sisa==0)break;
			a[i]+=min(k,sisa);
			sisa-=min(k,sisa);
		}
		if(!sisa)break;
	}
	for(int i=1;i<=n;i++){
		if(i<n)cout << a[i] << " ";
		else cout << a[i] << '\n';
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 14 ms 768 KB Output is correct
4 Correct 14 ms 768 KB Output is correct
5 Execution timed out 1092 ms 384 KB Time limit exceeded
6 Correct 819 ms 504 KB Output is correct
7 Correct 868 ms 2172 KB Output is correct
8 Execution timed out 1088 ms 1152 KB Time limit exceeded