답안 #330054

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
330054 2020-11-23T15:03:34 Z M_W Labels (NOI20_labels) C++14
7 / 100
67 ms 5248 KB
#include <bits/stdc++.h>
using namespace std;
long long a[300300];
int main(){
	long long N, minn = 1, maxx = 1, c = 0;
	scanf("%lld", &N);
	a[0] = 1;
	for(long long i = 1, tmp; i < N; i++){
		scanf("%lld", &tmp);
		a[i] = a[i - 1] + tmp;
		minn = min(minn, a[i] + c);
		maxx = max(maxx, a[i] + c);
		
		if(minn <= 0) c += 1 - minn;
		if(maxx > N) c -= maxx - N;
	}
	if(minn + c != 1 || maxx + c != N){
		printf("-1");
		exit(0);
	}
	for(long long i = 0; i < N; i++)
		printf("%lld ", a[i] + c);
}

Compilation message

Labels.cpp: In function 'int main()':
Labels.cpp:6:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    6 |  scanf("%lld", &N);
      |  ~~~~~^~~~~~~~~~~~
Labels.cpp:9:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    9 |   scanf("%lld", &tmp);
      |   ~~~~~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Incorrect 1 ms 364 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Incorrect 1 ms 364 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 67 ms 5248 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Incorrect 30 ms 3436 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Incorrect 1 ms 364 KB Output isn't correct
6 Halted 0 ms 0 KB -