Submission #376773

#TimeUsernameProblemLanguageResultExecution timeMemory
376773maomao90Labels (NOI20_labels)C++14
100 / 100
95 ms6764 KiB
#include <bits/stdc++.h> using namespace std; #define mnto(x, y) x = min(x, (__typeof__(x)) y) #define mxto(x, y) x = max(x, (__typeof__(x)) y) #define REP(i, s, e) for (int i = s; i < e; i++) #define RREP(i, s, e) for (int i = s; i >= e; i--) typedef long long ll; typedef long double ld; #define MP make_pair #define FI first #define SE second typedef pair<int, int> ii; typedef pair<ll, ll> pll; #define MT make_tuple typedef tuple<int, int, int> iii; #define ALL(_a) _a.begin(), _a.end() #define pb emplace_back typedef vector<int> vi; typedef vector<ii> vii; #define INF 1000000005 #define LINF 1000000000000000005 #define MOD 1000000007 #define MAXN 300005 int n; int d[MAXN]; int arr[MAXN]; int mn; int main() { scanf("%d", &n); REP (i, 0, n - 1) { scanf("%d", &d[i]); } REP (i, 1, n) { arr[i] = arr[i - 1] + d[i - 1]; mnto(mn, arr[i]); } REP (i, 0, n) arr[i] -= mn; int mx = 0; REP (i, 0, n) mxto(mx, arr[i]); if (mx != n - 1) { printf("-1\n"); } else { REP (i, 0, n) { printf("%d ", arr[i] + 1); } printf("\n"); } return 0; }

Compilation message (stderr)

Labels.cpp: In function 'int main()':
Labels.cpp:33:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   33 |  scanf("%d", &n);
      |  ~~~~~^~~~~~~~~~
Labels.cpp:35:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   35 |   scanf("%d", &d[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...