제출 #1111583

#제출 시각아이디문제언어결과실행 시간메모리
1111583itslqTrains (BOI24_trains)C++17
21 / 100
2064 ms616 KiB
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; int main() { int N, D, X, S = 0; cin >> N; vector<int> W(N); W[0] = 1; for (int i = 0; i < N; i++) { cin >> D >> X; if (D) { for (int j = 0, x = i + D; j < X && x < N; x += D, j++) { W[x] = (W[x] + W[i]) % MOD; } } } for (int i = 0; i < N; i++) { S = (S + W[i]) % MOD; } cout << S; }
#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...