제출 #1111456

#제출 시각아이디문제언어결과실행 시간메모리
1111456Informatics271Trains (BOI24_trains)C++17
21 / 100
183 ms764 KiB
#include <iostream> #include <algorithm> using namespace std; int N; int D[10005]; int X[10005]; //int N=7; int D[10005]={1,2,2,0,2,2,2}; int X[10005]={2,1,1,2,100,100,100}; long long dp[10005]; int mod=1000000007; int main(){ cin >> N; for (int i=0;i<N;i++) cin>>D[i]>>X[i]; for (int i=N-1; i>=0; i--){ dp[i]++; if (D[i]==0) continue; for (int j=1; j<=X[i]&&i+j*D[i]<N; j++) dp[i]=(dp[i]+dp[i+j*D[i]])%mod; //cout << i << dp[i] << i+D[i]*X[i] << '\n'; } cout << dp[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...