結果

問題 No.2324 Two Countries within UEC
ユーザー m_99m_99
提出日時 2023-05-28 13:36:16
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 601 bytes
コンパイル時間 4,030 ms
コンパイル使用メモリ 227,168 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-27 08:07:21
合計ジャッジ時間 10,541 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 231 ms
4,380 KB
testcase_01 AC 244 ms
4,376 KB
testcase_02 AC 45 ms
4,376 KB
testcase_03 AC 181 ms
4,384 KB
testcase_04 AC 210 ms
4,380 KB
testcase_05 AC 47 ms
4,376 KB
testcase_06 AC 83 ms
4,380 KB
testcase_07 AC 38 ms
4,380 KB
testcase_08 AC 181 ms
4,380 KB
testcase_09 AC 187 ms
4,376 KB
testcase_10 AC 247 ms
4,376 KB
testcase_11 AC 243 ms
4,380 KB
testcase_12 AC 75 ms
4,376 KB
testcase_13 AC 73 ms
4,376 KB
testcase_14 AC 44 ms
4,376 KB
testcase_15 AC 38 ms
4,376 KB
testcase_16 AC 166 ms
4,380 KB
testcase_17 AC 105 ms
4,380 KB
testcase_18 AC 49 ms
4,380 KB
testcase_19 AC 245 ms
4,376 KB
testcase_20 AC 32 ms
4,380 KB
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 AC 246 ms
4,380 KB
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 AC 1 ms
4,376 KB
testcase_32 AC 1 ms
4,380 KB
testcase_33 AC 1 ms
4,380 KB
testcase_34 AC 1 ms
4,376 KB
testcase_35 AC 2 ms
4,380 KB
testcase_36 AC 2 ms
4,376 KB
testcase_37 AC 2 ms
4,380 KB
testcase_38 AC 2 ms
4,380 KB
testcase_39 AC 1 ms
4,376 KB
testcase_40 AC 2 ms
4,376 KB
testcase_41 RE -
testcase_42 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
using mint = modint998244353;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000001
#define Inf64 4000000000000000001


int main(){
	
	int N,M;
	cin>>N>>M;
	int P,Q;
	cin>>P>>Q;
	rep(i,Q){
		int x,y;
		cin>>x>>y;
		if(y==0){
			if(x%P==0){
				cout<<M<<endl;
			}
			else{
				cout<<M/P<<endl;
			}
		}
		else{
			long long t = y;
			t *= inv_mod(x,P);
			t %= P;
		//	cout<<t<<endl;
			long long ans = M/P;
			if(M%P>=t)ans++;
			cout<<ans<<endl;
		}
	}
	
	return 0;
}
0