제출 #166536

#제출 시각아이디문제언어결과실행 시간메모리
166536luciocfCalvinball championship (CEOI15_teams)C++14
20 / 100
153 ms65540 KiB
#include <bits/stdc++.h>

using namespace std;

const int maxn = 1e4+10;
const int mod = 1e9+7;

int n;
int a[maxn];

int dp[maxn][maxn];
int pref[maxn][maxn];

int main(void)
{
    scanf("%d", &n);

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

    for (int i = 1; i <= n; i++)
        dp[1][i] = 1;

    for (int i = 2; i <= n; i++)
    {
        for (int j = 1; j <= n; j++)
        {
            dp[i][j] = (1ll*j*dp[i-1][j])%mod;
            dp[i][j] = (dp[i][j] + dp[i-1][j+1])%mod;
        }
    }

    int ans = 0, mx = 0;

    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j < a[i]; j++)
            ans = (ans + dp[n-i+1][max(mx, j)])%mod;

        mx = max(mx, a[i]);
    }

    printf("%d\n", ans+1);
}

컴파일 시 표준 에러 (stderr) 메시지

teams.cpp: In function 'int main()':
teams.cpp:16:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
teams.cpp:19:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &a[i]);
         ~~~~~^~~~~~~~~~~~~
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…