# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
548338 | 2022-04-13T04:32:30 Z | krit3379 | Calvinball championship (CEOI15_teams) | C++17 | 642 ms | 600 KB |
#include<bits/stdc++.h> using namespace std; #define N 10005 long long a[N],p[2][N],ma[N],ans=1,mod=1e6+7; int main(){ int n,i,j,k,now=0,prev; scanf("%d",&n); for(i=1;i<=n;i++)scanf("%lld",&a[i]); for(i=1;i<=n;i++)p[now][i]=1,ma[i]=max(a[i],ma[i-1]); for(i=1;i<=n;i++){ prev=now; now=1-now; for(j=1;j<=n;j++){ p[now][j]=(j*p[prev][j]+p[prev][j+1])%mod; } ans+=(a[n-i+1]-1)*p[prev][ma[n-i]]; ans%=mod; } printf("%lld",ans); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 212 KB | Output is correct |
2 | Correct | 2 ms | 212 KB | Output is correct |
3 | Correct | 2 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 340 KB | Output is correct |
2 | Correct | 7 ms | 340 KB | Output is correct |
3 | Correct | 8 ms | 344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 640 ms | 596 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 159 ms | 472 KB | Output is correct |
2 | Correct | 162 ms | 468 KB | Output is correct |
3 | Correct | 156 ms | 468 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 642 ms | 596 KB | Output is correct |
2 | Correct | 639 ms | 600 KB | Output is correct |
3 | Correct | 634 ms | 596 KB | Output is correct |