# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
244424 | 2020-07-04T05:29:55 Z | dwsc | Calvinball championship (CEOI15_teams) | C++14 | 18 ms | 8320 KB |
#include <bits/stdc++.h> #define int long long using namespace std; int MOD = 1e9+7; int memo[1010][1010]; int maxi[1010]; int n; int dp(int pos,int largest){ if (pos == n) return 1; if (memo[pos][largest] != -1) return memo[pos][largest]; int ans = (largest*dp(pos+1,largest))%MOD; if (maxi[pos] > largest) ans += dp(pos+1,largest+1); return memo[pos][largest] = ans%MOD; } main(){ cin >> n; for (int i = 0; i < n; i++){ int x; cin >> x; if (i == 0) maxi[i] = x; else maxi[i] = max(maxi[i-1],x); } for (int i = 0; i < 1010; i++) for (int j = 0; j < 1010; j++) memo[i][j] =-1; cout << dp(0,0); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 8320 KB | Output is correct |
2 | Correct | 8 ms | 8320 KB | Output is correct |
3 | Incorrect | 8 ms | 8320 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 8320 KB | Output is correct |
2 | Incorrect | 8 ms | 8320 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 9 ms | 8320 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 8 ms | 8320 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 11 ms | 8320 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 8 ms | 8320 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 9 ms | 8320 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 18 ms | 8320 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 11 ms | 8320 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 13 ms | 8320 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |