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