제출 #320594

#제출 시각아이디문제언어결과실행 시간메모리
320594saarang123Labels (NOI20_labels)C++14
100 / 100
76 ms4836 KiB
#include <bits/stdc++.h> using namespace std; signed main() { std::ios::sync_with_stdio(0); std::cout.tie(0); std::cin.tie(0); int n; cin >> n; vector<int> d(n, -1), a(n); for(int i = 1; i < n; i++) cin >> d[i]; int max_id = 0, min_id = 0; a[0] = n; for(int i = 1; i < n; i++) { a[i] = d[i] + a[i - 1]; if(a[i] > a[max_id]) max_id = i; if(a[i] < a[min_id]) min_id = i; } auto left = [&] (int x) { for(int i = x - 1; i >= 0; i--) a[i] = a[i + 1] - d[i + 1]; }; auto right = [&] (int x) { for(int i = x + 1; i < n; i++) a[i] = d[i] + a[i - 1]; }; a[max_id] = n; left(max_id); right(max_id); if(a[min_id] > 1) cout << -1 << '\n'; else { for(int i = 0; i < n; i++) cout << a[i] << ' '; cout << '\n'; } return 0; }

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

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