# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
130506 | 2019-07-15T11:44:21 Z | m3r8 | Calvinball championship (CEOI15_teams) | C++14 | 353 ms | 672 KB |
#include <stdio.h> #define MOD 1000007 #define ll long long ll anzN[10010]; ll mx; int num[10010]; void updateS(){ for(int i = mx;i>1;i--){ if(anzN[i]){ anzN[i+1] += anzN[i]; anzN[i] = anzN[i] * (i-1); anzN[i] %= MOD; mx = mx < i+1 ? i+1:mx; }; }; }; int used[10010]; int getA(int idx){ for(int i = 0;i<idx;i++){ used[i] = 0; }; int erg = 0; for(int i = 0;i<idx;i++){ if(!used[num[i]]){ used[num[i]] = 1; erg++; }; }; return erg+1; }; ll sum(){ ll erg = 0; for(int i = 2;i<=mx;i++){ erg += anzN[i] * i; erg %= MOD; }; return erg; }; int main(void){ int n; scanf("%d",&n); for(int i = 0;i<n;i++){ scanf("%d",&num[i]); }; for(int i = 1;i<n-1;i++){ updateS(); int a = getA(i); //printf("%d\n",a); anzN[a] += num[i]-1; mx = mx < a ? a:mx; }; printf("%lld\n",(sum()+num[n-1])%MOD); };
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 256 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 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
# | 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 | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | 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 | 3 ms | 256 KB | Output is correct |
2 | Correct | 3 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 376 KB | Output is correct |
2 | Correct | 5 ms | 376 KB | Output is correct |
3 | Correct | 6 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 343 ms | 652 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 68 ms | 472 KB | Output is correct |
2 | Correct | 69 ms | 408 KB | Output is correct |
3 | Correct | 89 ms | 452 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 269 ms | 616 KB | Output is correct |
2 | Correct | 264 ms | 536 KB | Output is correct |
3 | Correct | 353 ms | 672 KB | Output is correct |