Submission #1076763

#TimeUsernameProblemLanguageResultExecution timeMemory
1076763sqrteipiLabels (NOI20_labels)C++14
0 / 100
27 ms5928 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; #define int long long #define i128 __int128 #define ff first #define ss second #define pii pair<int, int> #define vi vector<int> #define vvi vector<vector<int>> #define REP1(a) for (int _ = 0; _ < a; ++_) #define REP2(i, a) for (int i = 0; i < a; ++i) #define REP3(i, a, b) for (int i = a; i < b; ++i) #define REP4(i, a, b, c) for (int i = a; i < b; i += c) #define overload4(a, b, c, d, e, ...) e #define REP(...) overload4(__VA_ARGS__, REP4, REP3, REP2, REP1)(__VA_ARGS__) #define pb push_back #define fast_io ios::sync_with_stdio(0);cin.tie(0);cout.tie(0) template <class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; template <class T> using min_heap = priority_queue<T, vector<T>, greater<T>>; template <class T> using max_heap = priority_queue<T>; const int MOD = 1e9+7; const int INF = 1e18; int32_t main(){ fast_io; int n; cin >> n; int a[n-1]; REP(i, n-1) cin >> a[i]; int sum = 0, mn = 0, mx = 0; REP(i, n-1) sum += a[i], mn = min(mn, sum), mx = max(mx, sum); if (mx - mn != n - 1) cout << -1; else { int k = n - (mx - mn); cout << k << " "; REP(i, n-1) k += a[i], cout << k << " "; } }
#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...