제출 #1123223

#제출 시각아이디문제언어결과실행 시간메모리
1123223PwoTrains (BOI24_trains)C++17
8 / 100
2094 ms1336 KiB
#include <bits/stdc++.h> using namespace std; #define int long long int n, dp[100005]; pair<int, int> a[100005]; int32_t main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin >> n; for (int i = 1; i <= n; i++) cin >> a[i].first >> a[i].second; dp[1] = 1; for (int i = 2; i <= n; i++) { for (int j = 1; j < i; j++) { if (a[j].first == 0) continue; int d = i - j; if (d % a[j].first == 0 && (d / a[j].first) <= a[j].second) dp[i] += dp[j]; } } int ans = 0; for (int i = 1; i <= n; i++) ans += dp[i]; cout << ans; }
#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...