답안 #527149

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
527149 2022-02-17T02:45:41 Z joelau Calvinball championship (CEOI15_teams) C++14
70 / 100
92 ms 65540 KB
#include <bits/stdc++.h>
using namespace std;
 
long long N, A[10005], dp[10005][10005], p = 1000007;
 
int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    cin >> N;
    for (long long i = 1; i <= N; ++i) cin >> A[i];
    for (long long i = 1; i <= N; ++i) dp[N+1][i] = 1;
    for (long long i = N; i > 0; --i) for (long long j = 1; j <= N; ++j) dp[i][j] = (dp[i+1][j] * j + dp[i+1][j+1]) % p;
    long long ans = 1, most = 0;
    for (long long i = 1; i <= N; ++i) {
        ans = (ans + dp[i+1][most] * min(most,A[i]-1)) % p;
        for (long long j = most+1; j < A[i]; ++j) ans = (ans + dp[i+1][j]) % p;
        most = max(most,A[i]);
    }
    cout << ans;
 
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 0 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 324 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 0 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 716 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 716 KB Output is correct
2 Correct 1 ms 716 KB Output is correct
3 Correct 1 ms 708 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 4300 KB Output is correct
2 Correct 3 ms 4300 KB Output is correct
3 Correct 5 ms 4292 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 12228 KB Output is correct
2 Correct 12 ms 12220 KB Output is correct
3 Correct 12 ms 12284 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 81 ms 65540 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 80 ms 65540 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 92 ms 65540 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -