제출 #1118554

#제출 시각아이디문제언어결과실행 시간메모리
1118554EfeBabagilTrains (BOI24_trains)C++14
0 / 100
23 ms2140 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+1]+ans[i])%mod; if(i+city[i].second+1<n){ ans[i+city[i].second+1]=(ans[i+city[i].second+1]-ans[i])%mod; } } 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...