Submission #1057137

#TimeUsernameProblemLanguageResultExecution timeMemory
10571370npataTrains (BOI24_trains)C++17
21 / 100
2097 ms3920 KiB
#include<bits/stdc++.h> using namespace std; #define int long long #define vec vector const int MOD = 1e9 + 7; int32_t main() { int N; cin >> N; vec<int> D(N), X(N); for(int i = 0; i<N; i++) { cin >> D[i]; cin >> X[i]; } vec<int> f(N, 1); for(int i = N-2; i>=0; i--) { if(D[i] == 0) continue; for(int j = 1; j<=X[i] && i+(j*D[i]) < N; j++) { f[i] += f[i+(j*D[i])]; f[i] %= MOD; assert(i+(j*D[i]) < N); } } cout << f[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...