Submission #1111579

#TimeUsernameProblemLanguageResultExecution timeMemory
1111579Informatics271Trains (BOI24_trains)C++17
21 / 100
2062 ms1616 KiB
#include <iostream> #include <algorithm> using namespace std; int N; int D[100005]; int X[100005]; //int N=10; int D[100005]={1}; int X[100005]={100,100,100,100}; long long dp[100005]; int mod=1000000007; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); 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...