結果
問題 |
No.2961 Shiny Monster Master
|
ユーザー |
|
提出日時 | 2024-11-16 16:17:15 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 494 bytes |
コンパイル時間 | 3,543 ms |
コンパイル使用メモリ | 251,996 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-16 16:19:00 |
合計ジャッジ時間 | 7,593 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 1 WA * 76 |
ソースコード
#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(); ans--; cout<<ans<<endl; } }