제출 #674601

#제출 시각아이디문제언어결과실행 시간메모리
674601QwertyPiLabels (NOI20_labels)C++14
100 / 100
139 ms6708 KiB
#include <bits/stdc++.h> using namespace std; const int N = 3e5 + 11; int a[N], d[N]; int main(){ int n; cin >> n; for(int i = 0; i < n - 1; i++) cin >> d[i]; a[0] = 0; for(int i = 0; i < n - 1; i++) a[i + 1] = a[i] + d[i]; int _min = *min_element(a, a + n), _max = *max_element(a, a + n); if(_max - _min != n - 1){ cout << -1 << endl; }else{ for(int i = 0; i < n; i++) cout << a[i] - _min + 1 << ' '; cout << endl; } }

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

Labels.cpp: In function 'int main()':
Labels.cpp:15:3: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   15 |   for(int i = 0; i < n; i++) cout << a[i] - _min + 1 << ' '; cout << endl;
      |   ^~~
Labels.cpp:15:62: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   15 |   for(int i = 0; i < n; i++) cout << a[i] - _min + 1 << ' '; cout << endl;
      |                                                              ^~~~
#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...