답안 #118755

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
118755 2019-06-19T16:24:02 Z silxikys Calvinball championship (CEOI15_teams) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

const int maxn = 1e4+4, M = 1e
int k[maxn];

void madd(int& a, int b) {
	a = (a+b) % M;
}
int mult(int a, int b) {
	return (1LL*a*b) % M;
}

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        k[i] = max(k[i-1],a[i-1]);
    }
    for (int i = 1; i <= n+1; i++) {
    	dp[0][i] = 1;
    }

    int ans = 0;
    for (int i = n; i >= 1; i--) {
    	for (int j = 1; j <= i; j++) {
    		dp[1][j] = (mult(j,dp[0][j]) + dp[0][j+1]) % M;
    	}
        if (k[i] < a[i]) {
            madd(ans,mult(k[i],dp[0][k[i]]));
        }
        else {
            madd(ans,mult(a[i]-1,dp[0][k[i]]));
        }

    	for (int j = 1; j <= n; j++) {
    		dp[0][j] = dp[1][j];
    	}
    }

    cout << ((ans+1)%M) << '\n';
}

Compilation message

teams.cpp:5:29: error: exponent has no digits
 const int maxn = 1e4+4, M = 1e
                             ^~
teams.cpp: In function 'int main()':
teams.cpp:18:12: error: 'n' was not declared in this scope
     cin >> n;
            ^
teams.cpp:20:16: error: 'a' was not declared in this scope
         cin >> a[i];
                ^
teams.cpp:21:9: error: 'k' was not declared in this scope
         k[i] = max(k[i-1],a[i-1]);
         ^
teams.cpp:24:6: error: 'dp' was not declared in this scope
      dp[0][i] = 1;
      ^~
teams.cpp:30:7: error: 'dp' was not declared in this scope
       dp[1][j] = (mult(j,dp[0][j]) + dp[0][j+1]) % M;
       ^~
teams.cpp:32:13: error: 'k' was not declared in this scope
         if (k[i] < a[i]) {
             ^
teams.cpp:32:20: error: 'a' was not declared in this scope
         if (k[i] < a[i]) {
                    ^
teams.cpp:33:32: error: 'dp' was not declared in this scope
             madd(ans,mult(k[i],dp[0][k[i]]));
                                ^~
teams.cpp:36:34: error: 'dp' was not declared in this scope
             madd(ans,mult(a[i]-1,dp[0][k[i]]));
                                  ^~
teams.cpp:40:7: error: 'dp' was not declared in this scope
       dp[0][j] = dp[1][j];
       ^~