답안 #810916

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
810916 2023-08-06T17:27:15 Z JakobZorz Calvinball championship (CEOI15_teams) C++14
30 / 100
6 ms 8136 KB
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <set>
#include <stack>
#include <limits.h>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <cstring>
#include <sstream>
 
#pragma GCC target("popcnt")
 
typedef long long ll;
typedef long double ld;
using namespace std;
const int MOD=1e6+7;
typedef pair<ll,ll>point;
//#define x first
//#define y second

int n;
int arr[10000];
ll dp[1001][1002];

int main(){
    ios::sync_with_stdio(false);
    cout.tie(NULL);
    cin.tie(NULL);
    
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>arr[i];
        arr[i]--;
    }
    
    for(int teams=0;teams<n;teams++)
        dp[n][teams]=1;
    
    for(int i=n-1;i>0;i--){
        for(int teams=n;teams>=0;teams--){
            
            dp[i][teams]+=teams*dp[i+1][teams];
            dp[i][teams]+=dp[i+1][teams+1];
            dp[i][teams]%=MOD;
        }
    }
    
    ll res=1;
    
    int teams=0;
    for(int i=0;i<n;i++){
        teams=max(teams,arr[i]);
        
        res+=arr[i]*dp[i+1][teams];
        res%=MOD;
    }
    
    cout<<res<<"\n";
    
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 328 KB Output is correct
4 Correct 0 ms 328 KB Output is correct
5 Correct 0 ms 324 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 724 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 712 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 4180 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 8136 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 596 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 468 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 468 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -