# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
23122 | 2017-05-03T10:22:29 Z | model_code | Calvinball championship (CEOI15_teams) | C | 139 ms | 1348 KB |
#include <stdio.h> #define MAXN 10000 #define MP 1000007 static long long num[2][MAXN]; static int seq[MAXN]; static int max_till[MAXN]; int main (void) { int i, k, n, old, before = 0; scanf ("%d", &n); for (i = 0; i < n; i++) { num[0][i] = 1; scanf ("%d", &seq[i]); } max_till[0] = 0; for (i = 1; i < n; i++) if (max_till[i - 1] < seq[i - 1]) max_till[i] = seq[i - 1]; else max_till[i] = max_till[i - 1]; old = 0; for (i = n - 1; i >= 0; i--) { int p = (num[old][max_till[i]] * (seq[i] - 1)) % MP; before = (before + p) % MP; for (k = 0; k < i; k++) num[1 - old][k] = (k * num[old][k] + num[old][k + 1]) % MP; old = 1 - old; } printf ("%d\n", before + 1); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 1348 KB | Output is correct |
2 | Correct | 0 ms | 1348 KB | Output is correct |
3 | Correct | 0 ms | 1348 KB | Output is correct |
4 | Correct | 0 ms | 1348 KB | Output is correct |
5 | Correct | 0 ms | 1348 KB | Output is correct |
6 | Correct | 0 ms | 1348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 1348 KB | Output is correct |
2 | Correct | 0 ms | 1348 KB | Output is correct |
3 | Correct | 0 ms | 1348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 1348 KB | Output is correct |
2 | Correct | 0 ms | 1348 KB | Output is correct |
3 | Correct | 0 ms | 1348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 1348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 1348 KB | Output is correct |
2 | Correct | 0 ms | 1348 KB | Output is correct |
3 | Correct | 0 ms | 1348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 1348 KB | Output is correct |
2 | Correct | 0 ms | 1348 KB | Output is correct |
3 | Correct | 0 ms | 1348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 1348 KB | Output is correct |
2 | Correct | 0 ms | 1348 KB | Output is correct |
3 | Correct | 0 ms | 1348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 106 ms | 1348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 26 ms | 1348 KB | Output is correct |
2 | Correct | 26 ms | 1348 KB | Output is correct |
3 | Correct | 26 ms | 1348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 139 ms | 1348 KB | Output is correct |
2 | Correct | 113 ms | 1348 KB | Output is correct |
3 | Correct | 109 ms | 1348 KB | Output is correct |