Submission #833712

#TimeUsernameProblemLanguageResultExecution timeMemory
833712rainboyLabels (NOI20_labels)C11
100 / 100
50 ms3528 KiB
#include <stdio.h> #define N 300000 int min(int a, int b) { return a < b ? a : b; } int max(int a, int b) { return a > b ? a : b; } int main() { static int aa[N]; int n, i, mn, mx; scanf("%d", &n); mn = 0, mx = 0; for (i = 1; i < n; i++) { scanf("%d", &aa[i]), aa[i] += aa[i - 1]; mn = min(mn, aa[i]), mx = max(mx, aa[i]); } if (mx - mn < n - 1) { printf("-1\n"); return 0; } for (i = 0; i < n; i++) printf("%d ", aa[i] - mn + 1); printf("\n"); return 0; }

Compilation message (stderr)

Labels.c: In function 'main':
Labels.c:12:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |  scanf("%d", &n);
      |  ^~~~~~~~~~~~~~~
Labels.c:15:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |   scanf("%d", &aa[i]), aa[i] += aa[i - 1];
      |   ^~~~~~~~~~~~~~~~~~~
#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...