제출 #1125698

#제출 시각아이디문제언어결과실행 시간메모리
1125698tte0Trains (BOI24_trains)C++20
0 / 100
2095 ms2632 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; 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...