Submission #96780

#TimeUsernameProblemLanguageResultExecution timeMemory
96780Retro3014Calvinball championship (CEOI15_teams)C++17
100 / 100
677 ms632 KiB
#include <iostream> #include <vector> #include <algorithm> #include <stdio.h> using namespace std; #define DIV 1000007 #define MAX_N 10000 typedef long long ll; int N; ll DP1[MAX_N+1], DP2[MAX_N+1]; int arr[MAX_N+1]; int main(){ scanf("%d", &N); for(int i=1; i<=N; i++){ scanf("%d", &arr[i]); } int mx = 0; for(int i=1; i<=N; i++){ for(int j=1; j<=N; j++){ DP2[j] =(DP1[j] * (ll)j + DP1[j -1]) % DIV; } for(int j=1; j<arr[i]; j++){ DP2[max(mx, j)] = (DP2[max(mx, j)]+1)%DIV; } mx = max(mx, arr[i]); for(int j=0; j<=N; j++){ DP1[j] = DP2[j]; DP2[j] = 0; } } ll ans = 0; for(int i=1; i<=N; i++){ ans = (ans+DP1[i])%DIV; } printf("%lld", ans+1); return 0; }

Compilation message (stderr)

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