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;
long long ans=0;
cin >> n;
vector<long long> a(n);
a[0]=1;
vector<int> v(n),x(n);
for(int i=0; i<n; i++){
cin >> v[i] >> x[i];
for(int j=i+v[i]; j<(x[i]+1)*v[i]+i; j+=v[i]){
a[j]+=a[i];
}
ans+=a[i];
}
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... |