Submission #1111424

#TimeUsernameProblemLanguageResultExecution timeMemory
1111424justin271828Trains (BOI24_trains)C++14
8 / 100
279 ms1360 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; ans = ans%1000000007; cout << ans; 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...