Submission #44853

#TimeUsernameProblemLanguageResultExecution timeMemory
44853bogdan10bosCalvinball championship (CEOI15_teams)C++14
70 / 100
33 ms8924 KiB
#include <bits/stdc++.h> using namespace std; //#define FILE_IO const int mod = 1e6 + 7; int N; int v[10005]; int dp[1005][1005]; int main() { #ifdef FILE_IO freopen("1.in", "r", stdin); freopen("1.out", "w", stdout); #endif scanf("%d", &N); for(int i = 1; i <= N; i++) scanf("%d", &v[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] = (dp[i - 1][j] * j + dp[i - 1][j + 1]) % mod; int ans = 1; int mx = 0; for(int i = 1; i <= N; i++) { for(int j = 1; j < v[i]; j++) (ans += dp[N - i + 1][max(mx, j)]) %= mod; mx = max(mx, v[i]); } printf("%d\n", ans); return 0; }

Compilation message (stderr)

teams.cpp: In function 'int main()':
teams.cpp:20:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &N);
     ~~~~~^~~~~~~~~~
teams.cpp:21:38: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i = 1; i <= N; i++) scanf("%d", &v[i]);
                                 ~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...