Submission #1028918

#TimeUsernameProblemLanguageResultExecution timeMemory
1028918avighnaLabels (NOI20_labels)C++17
100 / 100
44 ms6800 KiB
#include <bits/stdc++.h> typedef long long ll; int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(nullptr); ll n; std::cin >> n; std::vector<ll> d(n - 1); for (auto &i : d) { std::cin >> i; } ll min = 0, max = 0; for (ll i = 0, sum = 0; i < n - 1; ++i) { sum += d[i]; min = std::min(min, sum); max = std::max(max, sum); } if (max - min + 1 != n) { std::cout << "-1\n"; return 0; } std::cout << n - max << ' '; for (ll i = 1, sum = n - max; i < n; ++i) { sum += d[i - 1]; std::cout << sum << ' '; } std::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...