제출 #1111434

#제출 시각아이디문제언어결과실행 시간메모리
1111434zhehanTrains (BOI24_trains)C++14
8 / 100
2079 ms1010492 KiB
#include <bits/stdc++.h> using namespace std; vector<int> stops[10000+10]; int routes(int station){ int ways=1; for(auto e:stops[station]){ ways+=routes(e); ways%=(int)1e9+7; } return ways; } int main() { int n,d,x,s; cin>>n; for(int i=0;i<n;++i){ cin>>d>>x; if(d==0){ continue; } s=i+1; for(int j=0;j<x;++j){ if(s+d<=n){ s+=d; stops[i+1].push_back(s); }else{ break; } } } cout<<routes(1)%((int)1e9+7)<<'\n'; 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...