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() {
long long N;
cin >> N;
long long d[N];
long long x[N];
for (long long i = 0; i < N; i++) {
cin >> d[i] >> x[i];
}
long long total[N];
memset(total, 0, sizeof(total));
total[0] = 1;
for (long long i = 0; i < N; i++) {
if (d[i] == 0) continue;
for (long long j = 1; j <= x[i]; j++) {
if (i+j*d[i] >= N) break;
total[i+j*d[i]] += total[i];
total[i+j*d[i]]%=1000000007;
}
}
long long ans = 0;
for (long long i: total) ans += i;
cout << ans;
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... |