結果

問題 No.2961 Shiny Monster Master
ユーザー daiota
提出日時 2024-11-16 17:01:49
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 26 ms / 1,777 ms
コード長 494 bytes
コンパイル時間 1,995 ms
コンパイル使用メモリ 165,828 KB
実行使用メモリ 11,264 KB
最終ジャッジ日時 2024-11-16 17:02:02
合計ジャッジ時間 5,156 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 77
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int,int> P;
#define REP(i,n) for(int i=0;i<int(n);i++)




ll a[1000010];



int main(void){
	cin.tie(nullptr);  ios_base::sync_with_stdio(false);
	ll i,j;


	ll R,N;
	cin >> R >> N;
	for(i=1;i<=N;i++){
		ll x;
		cin >> x;
		a[x]=1;
	}

	for(i=1;i<R;i++) a[i]+=a[i-1];


	int Q;
	cin >> Q;
	while(Q--){

		ll l,r;
		cin >> l >> r;


		cout << r/R*N-(l-1)/R*N+a[r%R]-a[(l-1)%R] << endl;



	}





	return 0;

}
0