# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
47025 | 2018-04-26T12:54:04 Z | iletavcioski | Calvinball championship (CEOI15_teams) | C++17 | 393 ms | 864 KB |
#include <iostream> #include <vector> using namespace std; typedef long long ll; const ll mod = 1000007; int main() { int n; cin>>n; vector<int> v; vector<int> maxi; vector<int> dp; for(int i=0;i<n;i++) { int a; cin>>a; v.push_back(a); if(maxi.size()) { maxi.push_back(max(maxi[maxi.size()-1],a)); } else maxi.push_back(a); dp.push_back(1); } dp.push_back(1); ll brojac=1; for(int i=n-1;i>=0;i--) { int a; if(i==0) a=0; else a=maxi[i-1]; for(int j=1;j<v[i];j++) { brojac+=dp[max(a,j)]; brojac%=mod; } ll broj=dp[1]; for(int j=1;j<=i;j++) { dp[j]=1LL*j*dp[j]+dp[j+1]; dp[j]%=mod; } } cout<<brojac<<endl; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 2 ms | 396 KB | Output is correct |
3 | Correct | 2 ms | 396 KB | Output is correct |
4 | Correct | 3 ms | 420 KB | Output is correct |
5 | Correct | 2 ms | 420 KB | Output is correct |
6 | Correct | 2 ms | 600 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 600 KB | Output is correct |
2 | Correct | 2 ms | 600 KB | Output is correct |
3 | Correct | 2 ms | 600 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 600 KB | Output is correct |
2 | Correct | 2 ms | 684 KB | Output is correct |
3 | Correct | 2 ms | 700 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 700 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 700 KB | Output is correct |
2 | Correct | 2 ms | 700 KB | Output is correct |
3 | Correct | 2 ms | 716 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 716 KB | Output is correct |
2 | Correct | 2 ms | 716 KB | Output is correct |
3 | Correct | 3 ms | 716 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 728 KB | Output is correct |
2 | Correct | 3 ms | 728 KB | Output is correct |
3 | Correct | 7 ms | 736 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 393 ms | 860 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 35 ms | 860 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 144 ms | 864 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |