This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int main(){
int n, ans=0, d, x;
cin >> n;
vector<int> a(n,0);
a[0]=1;
for(int i=0; i<n; i++){
cin >> d >> x;
for(int j=i+d; j<i+d*(x+1); j+=d){
if(j<n){
a[j]+=a[i];
a[j]%=(int)1000000007;
}
}
ans+=a[i];
ans%=(int)1000000007;
}
cout << ans << endl;
return 0;
}
# | 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... |