Submission #244435

# Submission time Handle Problem Language Result Execution time Memory
244435 2020-07-04T05:48:41 Z dwsc Calvinball championship (CEOI15_teams) C++14
0 / 100
21 ms 8448 KB
/*#include <bits/stdc++.h>
#define int long long
using namespace std;
int MOD = 1e9+7;
int memo[1010][1010][2];
int maxi[1010],arr[1010];
int n;
int dp(int pos,int largest,int ssf){
    if (pos == n) return 1;
    if (memo[pos][largest][ssf] != -1) return memo[pos][largest][ssf];
    if (ssf){
        int curnum = arr[pos];
        int ans = ((curnum-1)*dp(pos+1,largest,0))%MOD;
        ans += dp(pos+1,max(largest,curnum),1);
        return memo[pos][largest][ssf] = ans%MOD;
    }
    else{
        int ans = (largest*dp(pos+1,largest,0))%MOD + dp(pos+1,largest+1,0);
        return memo[pos][largest][ssf] = ans%MOD;
    }
}
main(){
    cin >> n;
    for (int i = 0; i < n; i++){
        int x;
        cin >> x;
        arr[i] = 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][0] = memo[i][j][1] =-1;
    cout << dp(0,0,1);
}
*/
#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 + 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

teams.cpp:48:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
# 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 8 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 8 ms 8320 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 8320 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 15 ms 8320 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 21 ms 8320 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 17 ms 8448 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
2 Halted 0 ms 0 KB -