제출 #1066420

#제출 시각아이디문제언어결과실행 시간메모리
1066420Essa2006Trains (BOI24_trains)C++14
21 / 100
2078 ms1628 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long #define endl '\n' #define FF first #define SS second #define all(a) a.begin(), a.end() #define mod (ll)(1000000007) int main() { ios_base::sync_with_stdio(0);cin.tie(0); int n; cin >> n; vector<int> D(n), X(n); vector<ll> dp(n); ll sum = 0; for (int i = 0; i < n; i++) { cin >> D[i] >> X[i]; if (i == 0) { dp[i] = 1; sum += dp[i]; continue; } for (int j = 0; j < i; j++) { if (i <= j + (ll)D[j] * X[j] && ((i - j) % D[j] == 0)) { dp[i] += dp[j]; dp[i] %= mod; } } //cout << i + 1 << " : " << dp[i] << endl; sum += dp[i]; sum %= mod; } cout << sum; }
#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...