제출 #1118577

#제출 시각아이디문제언어결과실행 시간메모리
1118577dynam1cTrains (BOI24_trains)C++17
0 / 100
36 ms2344 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; int mod = 1e9+7; int main() { int n; cin >> n; vector<int> x(n), ans(n); ans[0] = 1; for (int i = 0; i < n; i++) cin >> x[i] >> x[i]; vector<int> diff(n+1); int cur = 0; for (int i = 0; i < n; i++) { if (i > 0) ans[i] = cur; cur = ((ll) cur + ans[i] + diff[i]) % mod; (diff[min(i+x[i], n)] += mod - ans[i]) %= mod; } cout << accumulate(ans.begin(), ans.end(), 0LL) % mod << endl; }
#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...