Submission #1111421

#TimeUsernameProblemLanguageResultExecution timeMemory
1111421justin271828Trains (BOI24_trains)C++14
8 / 100
277 ms1552 KiB
#include <bits/stdc++.h> using namespace std; int main() { long long N; cin >> N; long long d[N]; long long x[N]; for (long long i = 0; i < N; i++) { cin >> d[i] >> x[i]; } long long total[N]; memset(total, 0, sizeof(total)); total[0] = 1; for (long long i = 0; i < N; i++) { if (d[i] == 0) continue; for (long long j = 1; j <= x[i]; j++) { if (i+j*d[i] >= N) break; total[i+j*d[i]] += total[i]; } } long long ans = 0; for (long long i: total) ans += i; cout << ans%1000000007; return 0; }
#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...