Submission #1111896

#TimeUsernameProblemLanguageResultExecution timeMemory
1111896gelastropodTrains (BOI24_trains)C++14
0 / 100
19 ms2424 KiB
#include <bits/stdc++.h> using namespace std; #define int long long signed main() { int N, a, b; cin >> N; vector<int> pref(N + 1, 0), dp(N, 1); vector<pair<int, int>> vals; for (int i = 0; i < N; i++) { cin >> a >> b; vals.push_back({ a, b }); } for (int i = N - 1; i >= 0; i--) { dp[i] = (1 + pref[i + 1] - pref[min(N, i + vals[i].second + 1)]) % 1000000007; pref[i] = (dp[i] + pref[i + 1]) % 1000000007; } cout << dp[0] << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...