답안 #230105

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
230105 2020-05-08T11:00:25 Z parsa_mobed Calvinball championship (CEOI15_teams) C++14
100 / 100
388 ms 504 KB
#include <bits/stdc++.h>

using namespace std;
const int N = 1e4 + 5, MOD = 1e6 + 7;
int dp[N], a[N];

int main() {
    int n, mx = 0; cin >> n;
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 0; i < n; i++) {
        for (int j = n; j >= 2; j--) dp[j] = (1ll * dp[j] * j % MOD + dp[j - 1]) % MOD;
        dp[mx] = (dp[mx] + a[i] - 1) % MOD, mx = max(mx, a[i]);
    }
    int ans = 0;
    for (int i = 1; i <= n; i++) ans = (ans + dp[i]) % MOD;
    cout << ans + 1 << "\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 256 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 384 KB Output is correct
2 Correct 6 ms 384 KB Output is correct
3 Correct 6 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 384 KB Output is correct
2 Correct 9 ms 384 KB Output is correct
3 Correct 9 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 384 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 103 ms 384 KB Output is correct
2 Correct 103 ms 384 KB Output is correct
3 Correct 103 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 387 ms 504 KB Output is correct
2 Correct 384 ms 504 KB Output is correct
3 Correct 388 ms 384 KB Output is correct