# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
221942 | 2020-04-11T14:33:49 Z | MKopchev | Calvinball championship (CEOI15_teams) | C++14 | 288 ms | 616 KB |
#include<bits/stdc++.h> using namespace std; const int nmax=1e4+42,mod=1e6+7; int n,inp[nmax]; bool in[nmax]; pair<int/*coeff*/,int/*k*/> noted[nmax]; int dp[nmax]; long long help[nmax]; int main() { scanf("%i",&n); for(int i=1;i<=n;i++) scanf("%i",&inp[i]); int diff=0; for(int i=1;i<=n;i++) { if(in[inp[i]]==0)diff++; in[inp[i]]=1; noted[i+1]={inp[i]-1,diff-1}; if(i==n)noted[i+1].first++; } //for(int i=1;i<=n+1;i++)cout<<i<<" -> "<<noted[i].first<<" "<<noted[i].second<<endl; for(int i=2;i<=n+1;i++) { dp[noted[i].second]=(dp[noted[i].second]+noted[i].first)%mod; if(i==n+1) { int output=0; for(int k=1;k<=n;k++) output=(output+dp[k])%mod; printf("%i\n",output); return 0; } for(int k=1;k<=i;k++)help[k]=0; for(int k=1;k<=i;k++) { help[k]=(help[k]+1LL*k*dp[k])%mod; help[k+1]=(help[k+1]+dp[k])%mod; } for(int k=1;k<=i;k++)dp[k]=help[k]; //cout<<"i= "<<i<<" -> ";for(int k=1;k<=i;k++)cout<<dp[k]<<" ";cout<<endl; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 7 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 258 ms | 616 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 67 ms | 504 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 288 ms | 592 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |