Submission #1360711

#TimeUsernameProblemLanguageResultExecution timeMemory
1360711jumpWorst Reporter 3 (JOI18_worst_reporter3)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#define int long long

signed main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int n,q;
  std::cin >> n >> q;
  std::vector<int> slow={0};
  for(int i=0;i<n;i++){
    int in;
    std::cin >> in;
    in=slow.back()*(in/(slow.back()+1));
    slow.push_back(in);
  }
  while(q--){
    int time,tl,tr;
    std::cin >> time >> tl >> tr;
    int l=0,r=slow.size()+1;
    while(l<r){
      int mid=(l+r)/2;
      if(slow[mid]*(time/slow[mid])-mid<=tr)r=mid;
      else l=mid+1;
    }
    tr=r;
    l=-1,r=slow.size()
    while(l<r){
      int mid=(l+r+1)/2;
      if(slow[mid]*(time/slow[mid])-mid>=tl)l=mid;
      else r=mid-1;
    }
    tl=l;
    std::cout << tl-tr+1;
  }
}

Compilation message (stderr)

worst_reporter3.cpp: In function 'int main()':
worst_reporter3.cpp:26:23: error: expected ';' before 'while'
   26 |     l=-1,r=slow.size()
      |                       ^
      |                       ;
   27 |     while(l<r){
      |     ~~~~~