Submission #1111906

#TimeUsernameProblemLanguageResultExecution timeMemory
1111906gelastropodTrains (BOI24_trains)C++17
0 / 100
24 ms2248 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, 0); 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...