# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
163405 | 2019-11-13T06:44:25 Z | dantoh000 | Calvinball championship (CEOI15_teams) | C++14 | 83 ms | 65540 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int mod = 1000007; int main(){ int n; scanf("%d",&n); int a[n]; int k[n]; for (int i = 0; i < n; i++) { scanf("%d",&a[i]); if (i) k[i] = max(k[i-1],a[i]); else k[i] = a[i]; } ll ct[n+1][n+1]; ll ans = a[n-1]; for (int i = 0; i <= n; i++){ ct[0][i] = 1; } for (int j = 1; j < n-1; j++){ for (int i = 1; i < n; i++){ ct[j][i] = i*ct[j-1][i]+ct[j-1][i+1]; ct[j][i] %= mod; } //printf("before %d: %d unique numbers, adding %d %lld\n",a[j],k[n-j-2],a[n-j-1]-1,ct[j][k[n-j-2]]); ans += (a[n-j-1]-1)*ct[j][k[n-j-2]]; ans %= mod; } printf("%d",ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 2296 KB | Output is correct |
2 | Correct | 4 ms | 2296 KB | Output is correct |
3 | Correct | 4 ms | 2300 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 8184 KB | Output is correct |
2 | Correct | 11 ms | 8184 KB | Output is correct |
3 | Correct | 10 ms | 8184 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 83 ms | 65540 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 76 ms | 65536 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 77 ms | 65536 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |