Submission #85835

# Submission time Handle Problem Language Result Execution time Memory
85835 2018-11-21T21:41:21 Z kraljlavova1 Timovi (COCI18_timovi) C++11
30 / 80
21 ms 2436 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;
const int MAXN=200010;
int n,k,m;
int x,y,l,last;
int sol[MAXN];
int main(){
	cin>>n>>k>>m;
	x=m/k;
	l=m%k;
	y=x%(2*(n-1));
	x=x/(2*(n-1));
	for(int i=0;i<n;i++){
		sol[i]+=x*k;
	}
	for(int i=0;i<min(n,y);i++){
		sol[i]+=k;
		last=i;
	}
	y-=min(n,y);
	if(!y){
		last++;
		if(last==n) last-=2;
		sol[last]+=l;
	}
	else{
		for(int i=0;i<y;i++){
			sol[n-i-1]+=x*k;
			last=n-i-1;
		}
		last--;
		if(last==-1) last+=2;
		sol[last]+=l;
	}
	for(int i=0;i<n;i++){
		cout<<sol[i]<<" ";
	}
	cout<<"\n";
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 252 KB Output isn't correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Correct 19 ms 1700 KB Output is correct
4 Correct 19 ms 1700 KB Output is correct
5 Incorrect 2 ms 1700 KB Output isn't correct
6 Correct 2 ms 1700 KB Output is correct
7 Incorrect 21 ms 2392 KB Output isn't correct
8 Incorrect 20 ms 2436 KB Output isn't correct