結果

問題 No.1140 EXPotentiaLLL!
ユーザー HaaHaa
提出日時 2020-07-31 21:39:36
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 563 bytes
コンパイル時間 1,546 ms
コンパイル使用メモリ 165,448 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-20 22:16:50
合計ジャッジ時間 5,170 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 187 ms
4,376 KB
testcase_01 AC 187 ms
4,376 KB
testcase_02 WA -
testcase_03 AC 139 ms
4,376 KB
testcase_04 AC 114 ms
4,376 KB
testcase_05 AC 165 ms
4,376 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 32 ms
4,376 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 32 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
const ll MOD = 1000000007;
const ll INF = 1e18;
#define REP(i, n) for(int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()

int main() {
	int t; scanf("%d",&t);
	vector<bool> pr(5000001,1);
	pr[1]=0;
	for(int i=2;i<=5000000;i++){
		if(pr[i]){
			for(int j=i*2;j<=5000000;j+=i)
				pr[j]=0;
		}
	}
	while(t--){
		ll a, p; scanf("%ld %ld",&a,&p);
		if(pr[p])
			printf("1\n");
		else
			printf("-1\n");
	}
	return 0;
}
0