Submission #1111398

#TimeUsernameProblemLanguageResultExecution timeMemory
1111398RuichenTrains (BOI24_trains)C++17
0 / 100
2065 ms1608 KiB
#include <bits/stdc++.h> using namespace std; int main(){ int n, p, ans=0; cin >> n; vector<int> a(n,0); a[0]=1; vector<int> v(n),x(n); for(int i=0; i<n; i++){ cin >> v[i] >> x[i]; p=i; if(v[i]>0){ for(int j=0; j<x[i]; j++){ p+=v[i]; if(p<n){ a[p]+=a[i]; //cout << a[i] << " " << a[p] << endl; a[p]%=1000000007; } } } ans+=a[i]; ans%=1000000007; } cout << ans << endl; 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...