답안 #1053576

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1053576 2024-08-11T13:34:03 Z VMaksimoski008 Calvinball championship (CEOI15_teams) C++17
60 / 100
1000 ms 604 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;

const int mod = 1e6 + 7;
const int LOG = 20;
const int maxn = 1e5 + 5;

int dp[2][10005][2];

signed main() {
    int n;
    cin >> n;

    vector<int> v(n+1);
    for(int i=1; i<=n; i++) cin >> v[i];

    dp[0][1][0] = 1;
    for(int a=1; a<n; a++) {
        for(int b=1; b<=a; b++) {
            for(int c=0; c<2; c++) {
                for(int i=1; i<=b+1; i++) {
                    if(!c && i > v[a+1]) break;
                    dp[1][max(b, i)][c|(i<v[a+1])] = (dp[1][max(b, i)][c|(i<v[a+1])] + dp[0][b][c]) % mod;
                }
            }
        }

        for(int b=1; b<=n; b++) {
            for(int c=0; c<2; c++) {
                dp[0][b][c] = dp[1][b][c];
                dp[1][b][c] = 0;
            }
        }
    }

    long long ans = 0;
    for(int i=1; i<=n; i++) ans = (ans + dp[0][i][1]) % mod;
    cout << (ans + 1) % mod << '\n';
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 84 ms 436 KB Output is correct
2 Correct 83 ms 344 KB Output is correct
3 Correct 150 ms 440 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 617 ms 456 KB Output is correct
2 Correct 636 ms 592 KB Output is correct
3 Execution timed out 1069 ms 348 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1065 ms 604 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1038 ms 600 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1068 ms 604 KB Time limit exceeded
2 Halted 0 ms 0 KB -