# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
788130 | 2023-07-19T19:48:46 Z | rainboy | Fruits (NOI22_fruits) | C | 93 ms | 17840 KB |
#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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 300 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 344 KB | Output is correct |
3 | Correct | 5 ms | 1088 KB | Output is correct |
4 | Correct | 46 ms | 9252 KB | Output is correct |
5 | Correct | 93 ms | 17840 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 300 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 300 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 87 ms | 12732 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 300 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |