답안 #780050

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
780050 2023-07-12T06:07:05 Z vjudge1 Timovi (COCI18_timovi) C++17
30 / 80
12 ms 2888 KB
#include<bits/stdc++.h>
using namespace std;
#define lalala ios_base::sync_with_stdio(false);cin.tie(NULL);
//#define endl "\n"
#define ll long long
#define pb push_back
#define N 200005
int main(){
	lalala;
	ll int n,x,k;cin>>n>>x>>k;
	ll int arr[n];
	for(int i=0;i<n;i++){
		if(k>=x) arr[i]=x;
		else if(k>0)arr[i]=k;
		else arr[i]=0;
		k-=x;
	}
	if(k<=0){
		for(int i=0;i<n;i++)cout<<arr[i]<<" ";
		cout<<endl;
		return 0;
	}
	ll int hedef=k/((n-1)*x);
	k-=(hedef*x*(n-1));
	for(int i=1;i<n-1;i++)arr[i]+=(hedef*x);
	arr[0]+=(hedef+1)/2*x;
	arr[n-1]+=(hedef/2)*x;
	if(k>0){
		if(hedef%2){
			for(int i=n-2;i>-1;i--){
				if(k<=0)break;
				if(k<x)arr[i]+=k;
				else arr[i]+=x;
				k-=x;
			}
		}
		else{
			for(int i=1;i<n;i++){
				if(k<=0)break;
				if(k<x)arr[i]+=k;
				else arr[i]+=x;
				k-=x;
			}
		}
	}
	for(int i=0;i<n;i++)cout<<arr[i]<<" ";
	cout<<endl;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 11 ms 2284 KB Output is correct
4 Correct 11 ms 2260 KB Output is correct
5 Incorrect 0 ms 212 KB Output isn't correct
6 Incorrect 0 ms 212 KB Output isn't correct
7 Incorrect 12 ms 2888 KB Output isn't correct
8 Incorrect 12 ms 2840 KB Output isn't correct