Submission #1047185

#TimeUsernameProblemLanguageResultExecution timeMemory
1047185KarolZTrains (BOI24_trains)C++14
71 / 100
2117 ms781176 KiB
#include<iostream> #include<vector> #include<map> #pragma GCC optimize "Ofast" using namespace std; typedef long long ll; const ll mod=1000000007; map<int,ll>m[100010];//pozycja,o ile skok, ile dodac map<int,ll>::iterator it; int suck_int(){ char c=getchar_unlocked(); int wyn=0; while(c>='0'&&c<='9'){ wyn=wyn*10+c-'0'; c=getchar_unlocked(); } return wyn; } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll n,v1,v2,wyn=0,akt; //cin>>n; n=suck_int(); for(int i=1;i<=n;i++){ akt=0; if(i==1)akt++; for(it=m[i].begin();it!=m[i].end();it++){ akt+=it->second; if(i+it->first<=n)m[i+it->first][it->first]+=it->second; // else break; } //cin>>v1>>v2; v1=suck_int(); v2=suck_int(); if(i+v1<=n)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...