Submission #156352

#TimeUsernameProblemLanguageResultExecution timeMemory
156352AkashiCalvinball championship (CEOI15_teams)C++14
10 / 100
100 ms65540 KiB
#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; ///numarul de siruri care au lungimea i si incep cu caracterul j for(int i = 1; i <= n + 1 ; ++i) d[0][i] = 1, d[1][i] = i + 1; for(int i = 2; i <= n ; ++i) for(int j = 1; j <= n + 1 ; ++j) d[i][j] = (1LL * d[i - 1][j] * j + d[i - 1][j + 1]) % MOD; for(int i = 1; i <= n ; ++i){ for(int j = 1; j <= a[i] - 1 ; ++j){ cnt += d[n - i][j]; if(cnt >= MOD) cnt -= MOD; } } printf("%d", cnt); return 0; }

Compilation message (stderr)

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]);
         ~~~~~^~~~~~~~~~~~~
#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...