제출 #1111431

#제출 시각아이디문제언어결과실행 시간메모리
1111431justin271828Trains (BOI24_trains)C++14
21 / 100
2073 ms2780 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]; total[i+j*d[i]] %= 1000000007; } } long long ans = 0; for (long long i: total) ans += i; 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...