Submission #788130

#TimeUsernameProblemLanguageResultExecution timeMemory
788130rainboyFruits (NOI22_fruits)C11
5 / 100
93 ms17840 KiB
#include <stdio.h> #define N 400000 int main() { static int aa[N], cc[N]; static long long ss[N + 1]; static char used[N]; static int kk[N], xx[N], yy[N]; int n, k, i, l, a; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d", &aa[i]), aa[i]--; if (aa[i] >= 0) used[aa[i]] = 1; } for (a = 0; a < n; a++) scanf("%d", &cc[a]); k = 0; for (a = 0; a < n; a++) { kk[a] = k; if (!used[a]) ss[k + 1] = ss[k] + cc[a], k++; } for (k = 1; k <= n; k++) printf("%lld ", ss[n] - ss[n - k]); printf("\n"); l = 0; for (i = 1; i < n; i++) if (aa[i] == -2) l++; else { if (a > aa[i]) aa[i] = -1; else { xx[i] = kk[aa[i]], yy[i] = xx[i] - l; if (yy[i] < 0) aa[i] = -1; } } for (i = 0; i < n; i++) { } return 0; }

Compilation message (stderr)

Main.c: In function 'main':
Main.c:12:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |  scanf("%d", &n);
      |  ^~~~~~~~~~~~~~~
Main.c:14:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |   scanf("%d", &aa[i]), aa[i]--;
      |   ^~~~~~~~~~~~~~~~~~~
Main.c:19:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |   scanf("%d", &cc[a]);
      |   ^~~~~~~~~~~~~~~~~~~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...