# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
163380 | 2019-11-13T04:08:15 Z | dantoh000 | Calvinball championship (CEOI15_teams) | C++14 | 193 ms | 632 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[2][n+1]; ll ans = 0; for (int i = 0; i <= n; i++){ ct[0][i] = 1; } for (int j = 0; j < n-1; j++){ //printf("before: %d unique numbers, adding %d %lld\n",k[n-j-2],a[n-j-1]-1,ct[j%2][k[n-j-2]]); ans += (a[n-j-1]-1)*ct[j%2][k[n-j-2]]; ans %= mod; for (int i = 1; i < n; i++){ ct[1-j%2][i] = ct[j%2][i]+ct[j%2][i+1]; ct[1-j%2][i] %= mod; } } printf("%d",ans+1); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 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 | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Incorrect | 2 ms | 376 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 256 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 256 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 190 ms | 628 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 50 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 193 ms | 632 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |