結果

問題 No.1140 EXPotentiaLLL!
ユーザー zelnyokzelnyok
提出日時 2020-07-31 21:32:51
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,050 bytes
コンパイル時間 1,121 ms
コンパイル使用メモリ 124,292 KB
実行使用メモリ 22,792 KB
最終ジャッジ日時 2023-09-20 21:55:21
合計ジャッジ時間 5,158 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <iomanip>
#include <functional>
#include <bitset>
#include <limits>
#include <cstdio>
#include <cmath>
#include <cassert>
#include <random>

#ifdef DEBUG
#include "library/Utility/debug.cpp"
#else
#define debug(...)
#endif

#define rep(i,n) for(int i=0;i<(n);++i)
#define EL '\n'
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
using lnt = long long;
struct FIO{FIO(){std::cin.tie(0);std::cout.tie(0);std::ios_base::sync_with_stdio(0);std::cout<<std::fixed<<std::setprecision(15);}}fIO;
/*-*/

int main() {
	int t;
	std::cin >> t;
	lnt N=5000005;
	std::vector<int> prime(N,true);
	prime[0]=0; prime[1]=0;
	for(lnt i=2;i<N;i++) {
		if(!prime[i]) continue;
		for(lnt j=2;j*i<N;j++) {
			prime[i*j]=false;
		}
	}
	rep(tt,t) {
		lnt a,p;
		std::cin >> a >> p;
		if(prime[p]) print(1);
		else if(a%p==0) print(0);
		else print(-1);
	}
}
0