Submission #1047136

#TimeUsernameProblemLanguageResultExecution timeMemory
1047136KarolZTrains (BOI24_trains)C++14
16 / 100
25 ms26204 KiB
#include<iostream> #include<vector> #include<unordered_map> using namespace std; typedef long long ll; const ll mod=1000000007; unordered_map<ll,ll>m[100010];//pozycja,o ile skok, ile dodac unordered_map<ll,ll>::iterator it; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll n,v1,v2,wyn=0,akt; cin>>n; for(ll i=1;i<=n;i++){ akt=0; if(i==1)akt++; for(it=m[i].begin();it!=m[i].end();it++){ akt+=it->second; m[i+it->first][it->first]+=it->second%mod; } cin>>v1>>v2; m[i+v1][v1]+=akt%mod; if(i+v1*(v2+1)<=n&&i+v2<=n)m[i+v1*(v2+1)][v1]-=akt%mod-mod; wyn+=akt; wyn%=mod; } cout<<wyn; return 0; }
#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...