結果

問題 No.1140 EXPotentiaLLL!
ユーザー orieka
提出日時 2020-07-31 22:40:02
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 673 bytes
コンパイル時間 1,362 ms
コンパイル使用メモリ 96,948 KB
最終ジャッジ日時 2025-01-12 10:56:37
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 3 WA * 4 TLE * 5
権限があれば一括ダウンロードができます

ソースコード

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;
		cin >> a >> p;
		
		if( !is_prime(p) ) {
			cout << -1 << endl;
		} else {
			cout << 1 << endl;
		}
	}
	
	return 0;
}
0