#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef long long ll;
typedef vector<ll> vll;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int N;
int mod = 0x3B9ACA07;
cin >> N;
vll dp(N+1);
dp[1] = 1;
ll total = 1;
for (int i=1; i<=N; i++) {
ll d, x;
cin >> d >> x;
if (!d) continue;
ll t = 1, s = i + d;
cout << d << ' ' << x << '\n';
while (t <= x && s <= N) {
dp[s] += dp[i];
s += d;
t++;
total += dp[i];
total %= mod;
}
}
cout << total << endl;
}
| # | 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... |