結果

問題 No.2961 Shiny Monster Master
ユーザー twooimp2
提出日時 2024-11-16 15:56:05
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 458 bytes
コンパイル時間 3,366 ms
コンパイル使用メモリ 251,752 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-16 15:56:16
合計ジャッジ時間 6,329 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 1 WA * 76
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll=long long;

int main(){
  ll R,n;
  cin>>R>>n;
  vector<ll> a(n);
  for(ll i=0;i<n;i++){
    cin>>a[i];
  }
  sort(a.begin(),a.end());
  ll q;
  cin>>q;
  while(q--){
    ll l,r;
    cin>>l>>r;
    ll ans=0;
    ans+=n-(lower_bound(a.begin(),a.end(),l%R)-a.begin())-1;
    ans+=n*(r-(l+l%R))/R;
    ans+=upper_bound(a.begin(),a.end(),r-(l+l%R))-a.begin();
    ans=max(0LL,ans);
    cout<<ans<<endl;
  }
}
0