Submission #1118551

#TimeUsernameProblemLanguageResultExecution timeMemory
1118551EfeBabagilTrains (BOI24_trains)C++14
0 / 100
34 ms2080 KiB
#include <bits/stdc++.h> using namespace std; #define int long long int mod= 1e9+7; int32_t main() { int n; cin>>n; vector<pair<int,int>> city(n); vector<int> ans(n); for(int i=0;i<n;i++) { int a,b; cin>>a>>b; city[i]={a,b}; } ans[0]=1; for(int i=0;i<n;i++){ if(i+1<n) ans[i+1]+=ans[i]%mod; if(i+city[i].second+1<n) ans[i+city[i].second+1]-=ans[i]; } int sum=0; for(int i=0;i<n;i++){ sum+=ans[i]%mod; } //0 2 1 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...