// 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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |