답안 #156359

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
156359 2019-10-05T10:31:06 Z Akashi Calvinball championship (CEOI15_teams) C++14
70 / 100
98 ms 65540 KB
#include <bits/stdc++.h>
using namespace std;

const int MOD = 1000007;

int n;
int a[10005];
int d[10005][10005];

int main()
{
    scanf("%d", &n);
    for(int i = 1; i <= n ; ++i)
        scanf("%d", &a[i]);

    int l = 0, cnt = 1;

    for(int i = 1; i <= n ; ++i) d[0][i] = 1, d[1][i] = i + 1;
    d[1][n] = n;
    for(int i = 2; i <= n ; ++i)
        for(int j = 1; j <= n ; ++j)
            d[i][j] = (1LL * d[i - 1][j] * j + d[i - 1][j + 1]) % MOD;

    int Max = 0;
    for(int i = 1; i <= n ; ++i){
        for(int j = 1; j <= a[i] - 1 ; ++j){
            cnt += d[n - i][max(j, Max)];
            if(cnt >= MOD) cnt -= MOD;
        }
        Max = max(Max, a[i]);
    }
    printf("%d", cnt);

    return 0;
}













Compilation message

teams.cpp: In function 'int main()':
teams.cpp:16:9: warning: unused variable 'l' [-Wunused-variable]
     int l = 0, cnt = 1;
         ^
teams.cpp:12:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
teams.cpp:14:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &a[i]);
         ~~~~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 380 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 380 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 760 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 760 KB Output is correct
2 Correct 3 ms 760 KB Output is correct
3 Correct 3 ms 760 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 3320 KB Output is correct
2 Correct 6 ms 3320 KB Output is correct
3 Correct 5 ms 3320 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 8316 KB Output is correct
2 Correct 10 ms 8312 KB Output is correct
3 Correct 11 ms 8312 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 98 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
# 결과 실행 시간 메모리 Grader output
1 Runtime error 86 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 94 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -