# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
90749 | 2018-12-24T09:03:02 Z | Vinhspm | Calvinball championship (CEOI15_teams) | C++14 | 96 ms | 66560 KB |
#include<bits/stdc++.h> using namespace std; #define fi first #define se second #define FOR(a, b, c) for(int a = b; a <= c; ++a) #define pb push_back const int N = 1e5 + 10; const int mod = 1e6 + 7; int n, num; int a[N], cnt[N]; vector<int> f[N]; void add(int &x, int y) { x = (x + y) % mod; } signed main() { scanf("%d", &n); FOR(i, 1, n) scanf("%d", &a[i]); FOR(i, 0, n + 1) f[i].assign(i + 5, 0); FOR(i, 0, n) f[n + 1][i] = 1; for(int i = n; i >= 1; --i) FOR(j, 0, i) { add(f[i][j], f[i + 1][j] * j); add(f[i][j], f[i + 1][j + 1]); } int sum = 1; FOR(i, 1, n) { for(int j = 1; j < a[i]; ++j) { cnt[j] ++; if(cnt[j] == 1) num ++; add(sum, f[i + 1][num]); cnt[j] --; if(cnt[j] == 0) num --; } cnt[ a[i] ] ++; if(cnt[ a[i] ] == 1) num ++; } printf("%d", sum); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 2680 KB | Output is correct |
2 | Correct | 3 ms | 2864 KB | Output is correct |
3 | Correct | 3 ms | 2864 KB | Output is correct |
4 | Correct | 3 ms | 2864 KB | Output is correct |
5 | Correct | 3 ms | 2864 KB | Output is correct |
6 | Correct | 3 ms | 2864 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 2864 KB | Output is correct |
2 | Correct | 4 ms | 2864 KB | Output is correct |
3 | Correct | 4 ms | 2876 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 2876 KB | Output is correct |
2 | Correct | 4 ms | 2876 KB | Output is correct |
3 | Correct | 4 ms | 2876 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 2984 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 2984 KB | Output is correct |
2 | Correct | 4 ms | 2984 KB | Output is correct |
3 | Correct | 4 ms | 3084 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 3488 KB | Output is correct |
2 | Correct | 5 ms | 3492 KB | Output is correct |
3 | Correct | 5 ms | 3496 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 5036 KB | Output is correct |
2 | Correct | 7 ms | 5036 KB | Output is correct |
3 | Correct | 10 ms | 5044 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 66 ms | 66560 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 96 ms | 66560 KB | Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 61 ms | 66560 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |