Submission #1125700

#TimeUsernameProblemLanguageResultExecution timeMemory
1125700tte0Trains (BOI24_trains)C++20
21 / 100
2094 ms2680 KiB
// Author: Teoman Ata Korkmaz #include <bits/stdc++.h> #define int int_fast64_t using namespace std; constexpr int N=100005; constexpr int MOD=1e9+7; /////////////////////////////////////////////////////////// int n,d[N],x[N],v[N],ans; signed main(void){ cin>>n; for(int i=0;i<n;i++)cin>>d[i]>>x[i]; v[0]=1; for(int i=0;i<n;i++){ ans=(ans+v[i])%MOD; if(!d[i])continue; for(int j=1;j<=x[i] && i+j*d[i]<n;j++){ v[i+j*d[i]]+=v[i]; v[i+j*d[i]]%=MOD; } } cout<<ans<<endl; }
#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...