結果

問題 No.1140 EXPotentiaLLL!
ユーザー ryoissyryoissy
提出日時 2020-07-31 21:28:49
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 535 bytes
コンパイル時間 1,457 ms
コンパイル使用メモリ 164,444 KB
実行使用メモリ 10,512 KB
最終ジャッジ日時 2023-09-20 21:39:13
合計ジャッジ時間 5,085 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 191 ms
10,216 KB
testcase_01 AC 193 ms
10,228 KB
testcase_02 WA -
testcase_03 AC 154 ms
10,148 KB
testcase_04 AC 126 ms
10,244 KB
testcase_05 AC 179 ms
10,220 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 39 ms
10,288 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 38 ms
10,224 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int t;
bool prime[5000005];
ll fact[500005];

void solve(){
	ll a,p;
	scanf("%lld%lld",&a,&p);
	if(!prime[p]){
		printf("-1\n");
	}else{
		printf("1\n");
	}
}

int main(void){
	memset(prime,true,sizeof(prime));
	prime[0]=prime[1]=false;
	for(ll i=2;i<=5000000;i++){
		if(prime[i]){
			for(int j=i*2;j<=5000000;j+=i){
				prime[j]=false;
			}
		}
	}
	scanf("%d",&t);
	for(int i=0;i<t;i++){
		solve();
	}
	return 0;
}
0