Submission #47025

#TimeUsernameProblemLanguageResultExecution timeMemory
47025iletavcioskiCalvinball championship (CEOI15_teams)C++17
70 / 100
393 ms864 KiB
#include <iostream> #include <vector> using namespace std; typedef long long ll; const ll mod = 1000007; int main() { int n; cin>>n; vector<int> v; vector<int> maxi; vector<int> dp; for(int i=0;i<n;i++) { int a; cin>>a; v.push_back(a); if(maxi.size()) { maxi.push_back(max(maxi[maxi.size()-1],a)); } else maxi.push_back(a); dp.push_back(1); } dp.push_back(1); ll brojac=1; for(int i=n-1;i>=0;i--) { int a; if(i==0) a=0; else a=maxi[i-1]; for(int j=1;j<v[i];j++) { brojac+=dp[max(a,j)]; brojac%=mod; } ll broj=dp[1]; for(int j=1;j<=i;j++) { dp[j]=1LL*j*dp[j]+dp[j+1]; dp[j]%=mod; } } cout<<brojac<<endl; return 0; }

Compilation message (stderr)

teams.cpp: In function 'int main()':
teams.cpp:40:12: warning: unused variable 'broj' [-Wunused-variable]
         ll broj=dp[1];
            ^~~~
#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...