답안 #146094

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
146094 2019-08-22T06:07:19 Z miguel Calvinball championship (CEOI15_teams) C++14
30 / 100
252 ms 688 KB
    /*
    ░░░░░░░░░░░░░░░░▄▄█▀▀██▄▄░░░░░░░
    ░░░░░░░░░░░░░▄█▀▀░░░░░░░▀█░░░░░░
    ░░░░░░░░░░░▄▀░░░░░░░░░░░░░█░░░░░
    ░░░░░░░░░▄█░░░░░░░░░░░░░░░█░░░░░
    ░░░░░░░██▀░░░░░░░▄▄▄░░▄░█▄█▄░░░░
    ░░░░░▄▀░░░░░░░░░░████░█▄██░▀▄░░░
    ░░░░█▀░░░░░░░░▄▄██▀░░█████░██░░░
    ░░░█▀░░░░░░░░░▀█░▀█▀█▀▀▄██▄█▀░░░
    ░░░██░░░░░░░░░░█░░█░█░░▀▀▄█▀░░░░
    ░░░░█░░░░░█░░░▀█░░░░▄░░░░░▄█░░░░
    ░░░░▀█░░░░███▄░█░░░░░░▄▄▄▄█▀█▄░░
    ░░░░░▀██░░█▄▀▀██░░░░░░░░▄▄█░░▀▄░
    ░░░░░░▀▀█▄░▀▄▄░▄░░░░░░░███▀░░▄██
    ░░░░░░░░░▀▀▀███▀█▄░░░░░█▀░▀░░░▀█
    ░░░░░░░░░░░░▄▀░░░▀█▄░░░░░▄▄░░▄█▀
    ░░░▄▄▄▀▀▀▀▀█▀░░░░░█▄▀▄▄▄▄▄▄█▀▀░░
    ░▄█░░░▄██▀░░░░░░░░░█▄░░░░░░░░░░░
    █▀▀░▄█░░░░░░░░░░░░░░▀▀█▄░░░░░░░░
    █░░░█░░░░░░░░░░░░░░░░░░█▄░░░░░░░*/
    #include<bits/stdc++.h>
    using namespace std;
    #define pb push_back
    #define dbg(x) cout << #x << '=' << x << '\n';
    #define ll long long
    #define x first
    #define y second
    #define pi pair <int, int>
    #define vi vector <int>
    const ll mod = 1000007;
    const ll nmax=100010;
    #define int ll
    int n, a[10010];
    int dp[2][10010], mx, pr;//idx, max, eq or not
     
    int32_t main(){
        ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
        cin>>n;
        for(int i=1; i<=n; i++) cin>>a[i];
        dp[0][0]=0;
        for(int i=1; i<=n; i++){
    		pr=max(pr, a[i-1]);
    		mx=max(mx, a[i]);
    		for(int v=1; v<=mx; v++) dp[1][v]=0;
    		for(int v=1; v<=mx; v++){
    			dp[1][v]+=(dp[0][v-1]+dp[0][v]*v)%mod;
    			dp[1][v]%=mod;
    		}
    		dp[1][pr]+=min(pr, a[i]-1);
    		if(pr+1<a[i]) dp[1][pr+1]++;
    		//dbg(i);
    		for(int v=1; v<=mx; v++){
    			//cout<<v<<" "<<dp[1][v]<<endl;
    			dp[0][v]=dp[1][v];
    		}
    	}
    	int ans=0LL;
    	for(int i=1; i<=mx; i++) ans+=dp[1][i], ans%=mod;
    	cout<<(ans+1LL)%mod;
    }
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Incorrect 3 ms 380 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 380 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 252 ms 688 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 8 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -