結果
問題 |
No.2961 Shiny Monster Master
|
ユーザー |
|
提出日時 | 2024-11-16 16:09:43 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 483 bytes |
コンパイル時間 | 3,172 ms |
コンパイル使用メモリ | 251,068 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-16 16:11:20 |
合計ジャッジ時間 | 6,974 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 13 WA * 64 |
ソースコード
#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()); ll rest=(r-l+1)-(R-l%R+1); ll n1=rest/R; ans+=n1*n; ll n2=rest%R; ans+=upper_bound(a.begin(),a.end(),n2)-a.begin(); cout<<ans<<endl; } }