結果

問題 No.1140 EXPotentiaLLL!
ユーザー oriekaorieka
提出日時 2020-07-31 22:54:01
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 676 bytes
コンパイル時間 994 ms
コンパイル使用メモリ 100,052 KB
実行使用メモリ 12,040 KB
最終ジャッジ日時 2023-09-21 01:38:30
合計ジャッジ時間 8,234 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9 + 7);

template<typename T>
bool is_prime(T n) {
	for(T i = 2; i * i <= n; ++i) {
		if( n % i == 0 ) return false;
	}
	
	return true;
}

int main(void) {
	int t;
	cin >> t;
	
	for(int i = 0; i < t; ++i) {
		ll a, p;
		scanf("%ld %ld", &a, &p);
		
		if( !is_prime(p) ) {
			printf("-1\n");
		} else {
			printf("1\n");
		}
	}
	
	return 0;
}
0