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;
#define int long long
const int TAILLE_MAX=100*1000+5,LIMITE=400,MODU=1000*1000*1000+7;
int nbVal;
vector<int> cumu[LIMITE][LIMITE];
int duree[TAILLE_MAX],nbTraj[TAILLE_MAX];
int rep[TAILLE_MAX];
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin>>nbVal;
for (int i=1;i<=nbVal;i++) {
cin>>duree[i]>>nbTraj[i];
if (duree[i]==0) {
duree[i]=MODU;
}
}
for (int i=nbVal;i>=1;i--) {
for (int j=i;j<=min(nbVal,i+duree[i]*nbTraj[i]);j+=duree[i]) {
rep[i]+=rep[j];
rep[i]%=MODU;
}
rep[i]++;
rep[i]%=MODU;
//cout<<i<<" : "<<rep[i]<<endl;
}
cout<<rep[1]<<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... |