結果
問題 | No.2961 Shiny Monster Master |
ユーザー |
|
提出日時 | 2024-11-16 16:47:00 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 645 bytes |
コンパイル時間 | 5,381 ms |
コンパイル使用メモリ | 308,336 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-16 16:48:21 |
合計ジャッジ時間 | 8,916 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 4 WA * 73 |
ソースコード
#include<bits/stdc++.h>using namespace std;#include<atcoder/all>using namespace atcoder;using mint=atcoder::modint998244353;#pragma GCC optimize("O3")#pragma GCC optimize("unroll-loops")#define int long longsigned main(){int R,N;cin>>R>>N;vector<int> A(N);for(auto&&e:A)cin>>e;int Q;cin>>Q;while(Q--){int l,r;cin>>l>>r;if(l/R==r/R){l%=R;r%=R;cout<<upper_bound(A.begin(),A.end(),r)-lower_bound(A.begin(),A.end(),l)<<endl;}else{int t=r/R-l/R-1;int ret=t*N;ret+=A.end()-lower_bound(A.begin(),A.end(),l%R);ret+=upper_bound(A.begin(),A.end(),r%R)-A.begin();cout<<ret<<endl;}}}