Submission #44708

#TimeUsernameProblemLanguageResultExecution timeMemory
44708top34051Worst Reporter 3 (JOI18_worst_reporter3)C++17
12 / 100
16 ms656 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long const int maxn = 1e3 + 5; int n,q; ll dist[maxn]; int get(ll T, ll L) { int l = 1, r = n, mid, pos = 0; while(l<=r) { mid = (l+r)/2; if(-mid + (T/dist[mid])*dist[mid] >= L) { pos = mid; l = mid+1; } else r = mid-1; } return pos; } int main() { scanf("%d%d",&n,&q); dist[0] = 1; for(int i=1;i<=n;i++) { scanf("%lld",&dist[i]); dist[i] = (ll)ceil((double)dist[i]/dist[i-1]) * dist[i-1]; } while(q--) { ll T, L, R; int res = 0; scanf("%lld%lld%lld",&T,&L,&R); for(int i=0;i<=n;i++) { ll temp = -i+(T/dist[i])*dist[i]; if(L<=temp && temp<=R) res++; } printf("%d\n",res); } }

Compilation message (stderr)

worst_reporter3.cpp: In function 'int main()':
worst_reporter3.cpp:24:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d",&n,&q);
     ~~~~~^~~~~~~~~~~~~~
worst_reporter3.cpp:27:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld",&dist[i]);
         ~~~~~^~~~~~~~~~~~~~~~~
worst_reporter3.cpp:32:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld%lld%lld",&T,&L,&R);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...