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;
const int MOD = 1e9 + 7;
int main() {
int N, D, X, S = 0;
cin >> N;
vector<int> W(N);
W[0] = 1;
for (int i = 0; i < N; i++) {
cin >> D >> X;
if (D) {
for (int j = 0, x = i + D; j < X && x < N; x += D, j++) {
W[x] = (W[x] + W[i]) % MOD;
}
}
}
for (int i = 0; i < N; i++) {
S = (S + W[i]) % MOD;
}
cout << S;
}
# | 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... |