답안 #600289

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
600289 2022-07-20T16:25:31 Z Codula Labels (NOI20_labels) C++17
25 / 100
161 ms 23412 KB
//IOI 2023 I am coming.
 
#include "bits/stdc++.h"
 
using namespace std;
 
#define fast ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define int int64_t
#define pb push_back 
 
int32_t main(){
	fast;
	int n;
	cin>>n;
	vector<int>a(n);
	a[0]=0;
	int dy=0;
	for(int i=1;i<n;++i){
		int dx;
		cin>>dx;
		a[i]=a[i-1]+dx;
		dy=max(dy,a[i]);
	}
	map<int,int>mp;
	int dx=n-dy;
	int ans=1;
	for(int i=0;i<n;++i){
		ans&=(mp[a[i]]==0);
		mp[a[i]]++;
		a[i]+=dx;
		ans&=(a[i]>0);
	}
	if(ans==0){
		cout<<"-1\n";
	}
	else{
		for(auto i:a)cout<<i<<" ";
		cout<<"\n";
	}
    return 0;
}

//1 6 4 2 5 3
/*
 * 5 2 2 3 2
 * 
 * 
 * 
*/








# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Incorrect 0 ms 212 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Incorrect 0 ms 212 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 142 ms 23412 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 161 ms 23320 KB Output is correct
4 Correct 25 ms 2644 KB Output is correct
5 Correct 27 ms 2680 KB Output is correct
6 Correct 102 ms 12088 KB Output is correct
7 Correct 95 ms 12016 KB Output is correct
8 Correct 27 ms 2680 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Incorrect 0 ms 212 KB Output isn't correct
6 Halted 0 ms 0 KB -