답안 #900217

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
900217 2024-01-07T22:15:30 Z raphaelp Calvinball championship (CEOI15_teams) C++14
70 / 100
34 ms 65536 KB
#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long N;
    cin >> N;
    vector<long long> Tab(N);
    for (long long i = 0; i < N; i++)
    {
        cin >> Tab[i];
    }
    vector<vector<long long>> dp(N, vector<long long>(N, 1));
    for (long long i = N - 2; i >= 0; i--)
    {
        for (long long j = 0; j <= i; j++)
        {
            dp[i][j] = (dp[i + 1][j + 1] + (dp[i + 1][j] * (j + 1))) % 1000007;
        }
    }
    long long tot = 0;
    long long maxx = 0;
    for (long long i = 0; i < N; i++)
    {
        tot += (Tab[i] - 1) * dp[i][maxx - 1];
        tot = tot % 1000007;
        maxx = max(maxx, Tab[i]);
    }
    cout << (tot + 1) % 1000007;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 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 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 0 ms 348 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 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 436 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 8280 KB Output is correct
2 Correct 4 ms 8284 KB Output is correct
3 Correct 4 ms 8284 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 34 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 31 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 34 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -