제출 #1111416

#제출 시각아이디문제언어결과실행 시간메모리
1111416justin271828Trains (BOI24_trains)C++14
8 / 100
206 ms1360 KiB
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; int d[N]; int x[N]; for (int i = 0; i < N; i++) { cin >> d[i] >> x[i]; } int total[N]; memset(total, 0, sizeof(total)); total[0] = 1; for (int i = 0; i < N; i++) { if (d[i] == 0) continue; for (int j = 1; j <= x[i]; j++) { if (i+j*d[i] >= N) break; total[i+j*d[i]] += total[i]; } } int ans = 0; for (int i: total) ans += i; 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...