제출 #1109450

#제출 시각아이디문제언어결과실행 시간메모리
11094500pt1mus23Trains (BOI24_trains)C++14
58 / 100
996 ms808012 KiB
#include <bits/stdc++.h> using namespace std; #define int long long int #define ins insert #define pb push_back #define endl '\n' #define putr(x) cout<<x<<endl;return; #define all(x) x.begin(),x.end() int nxt(){ int x;cin>>x; return x; } const int mod = 1e9 +7, sze = 2e5 +10, inf = LLONG_MAX, LG = 20; const int B= 623; int pref[B][B]; int event[sze][B],dp[sze]; void nev(int pos,int jump,int val){ if(pos>=sze){ return; } if(val<0){ val = (val+mod)%mod; } event[pos][jump]=(event[pos][jump] +val)%mod; } void rush(){ int n; cin>>n; vector<pair<int,int>> arr(n+1); for(int i=1;i<=n;i++){ cin>>arr[i].first>>arr[i].second; } dp[1]=1; for(int i=1;i<=n;i++){ for(int j=1;j<B;j++){ int q= i%j; pref[ q ][j] = ( pref[q][j] + event[i][j] + mod)%mod; dp[i]=(dp[i] + pref[q][j] + mod )%mod; } if( arr[i].first){ if(arr[i].first >= B){ for(int j = arr[i].first + i, c = 1;c<=arr[i].second, j<=n; j+=arr[i].first, c++){ dp[j]= (dp[j] + dp[i] + mod)%mod; } } else{ nev(i + arr[i].first, arr[i].first, dp[i]); nev( i + arr[i].first*arr[i].second + arr[i].first, arr[i].first, -dp[i]); } } } int ans=0; for(int i=1;i<=n;i++){ ans=(ans+dp[i] + mod)%mod; } ans=(ans+mod)%mod; putr(ans); } signed main(){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int tt = 1; // cin>>tt; while(tt--){ rush(); } return 0; }

컴파일 시 표준 에러 (stderr) 메시지

Main.cpp: In function 'void rush()':
Main.cpp:43:54: warning: value computed is not used [-Wunused-value]
   43 |                 for(int j = arr[i].first + i, c = 1;c<=arr[i].second, j<=n; j+=arr[i].first, c++){
      |                                                     ~^~~~~~~~~~~~~~~
#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...