Submission #48171

#TimeUsernameProblemLanguageResultExecution timeMemory
48171marvenleeWorst Reporter 3 (JOI18_worst_reporter3)C++14
12 / 100
2064 ms5496 KiB
#include<iostream> #include<vector> #include<algorithm> #include<cmath> using namespace std; int main() { int n,q; cin >> n >> q; int slowness[n+1]; slowness[0]=0; for(int i=1;i<=n;i++) cin >> slowness[i]; int pattern[n+1]; pattern[0]=1; pattern[1]=slowness[1]; for(int i=2;i<=n;i++) { if(slowness[i]<=slowness[i-1]) pattern [i]=pattern[i-1]; else { int k= slowness[i]/pattern[i-1]; if(slowness[i]%pattern[i-1] !=0) k++; pattern[i]=pattern[i-1]*k; } } while(q--) { int L,R,t; cin >> t >> L >> R ; int ans=0; for(int i=0;i<=n;i++) { if((t/pattern[i])*pattern[i] -i >=L && (t/pattern[i])*pattern[i] -i <=R) ans +=1; } cout << ans << endl; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...