Submission #1111882

#TimeUsernameProblemLanguageResultExecution timeMemory
1111882gelastropodTrains (BOI24_trains)C++14
0 / 100
26 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, 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)]; pref[i] = dp[i] + pref[i + 1]; } 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...