제출 #1111501

#제출 시각아이디문제언어결과실행 시간메모리
1111501RuichenTrains (BOI24_trains)C++17
0 / 100
2092 ms612 KiB
#include <bits/stdc++.h> using namespace std; int main(){ int n, ans=0, d, x; cin >> n; vector<int> a(n,0); a[0]=1; for(int i=0; i<n; i++){ cin >> d >> x; if(d!=0){ for(long long j=i+d; j<=i+d*x; j+=d){ if(j<n){ a[j]+=a[i]; a[j]%=1000000007; } else{ break; } } } 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...