제출 #330058

#제출 시각아이디문제언어결과실행 시간메모리
330058oakLabels (NOI20_labels)C++14
100 / 100
79 ms5612 KiB
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,i;
	scanf("%d",&n);
	int arr[n],mi = 0,mx = 0;
	arr[0] = 0;
	for(i=1;i<n;i++){
		scanf("%d",&arr[i]);
		arr[i] += arr[i-1];
		mi = min(arr[i],mi);
		mx = max(arr[i],mx);
	}
	if(mx-mi+1 < n){
		printf("-1");
		return 0;
	}
	int c = 1 - mi;
	for(i=0;i<n;i++){
		printf("%d ",c+arr[i]);
	}
}

컴파일 시 표준 에러 (stderr) 메시지

Labels.cpp: In function 'int main()':
Labels.cpp:5:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    5 |  scanf("%d",&n);
      |  ~~~~~^~~~~~~~~
Labels.cpp:9:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    9 |   scanf("%d",&arr[i]);
      |   ~~~~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...