Submission #46863

#TimeUsernameProblemLanguageResultExecution timeMemory
46863HachikujiMayoiCalvinball championship (CEOI15_teams)C++14
100 / 100
131 ms1256 KiB
#include <bits/stdc++.h> using namespace std; const int N = 10007; const long long mod = 1000007; long long dp[N][2]; int C[N]; int main(){ int n; scanf("%d", &n); for(int i = 1; i <= n; ++i){ scanf("%d", &C[i]); } int M = 0; for(int i = 1; i <= n; ++i){ int B = i & 1; for(int j = 1; j <= i; ++j){ dp[j][B] = (dp[j][B ^ 1] * j + dp[j - 1][B ^ 1]) % mod; } dp[M][B] = (dp[M][B] + C[i] - 1) % mod; M = max(M, C[i]); } long long ans = 1; for(int i = 1; i <= n; ++i){ ans += dp[i][n & 1]; ans %= mod; } printf("%lld\n", ans); return 0; }

Compilation message (stderr)

teams.cpp: In function 'int main()':
teams.cpp:13:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
  ~~~~~^~~~~~~~~~
teams.cpp:15:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &C[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...