結果

問題 No.1140 EXPotentiaLLL!
コンテスト
ユーザー orieka
提出日時 2020-07-31 22:54:01
言語 C++17
(gcc 15.2.0 + boost 1.90.0)
コンパイル:
g++-15 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
TLE  
実行時間 -
コード長 676 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,112 ms
コンパイル使用メモリ 111,920 KB
実行使用メモリ 9,984 KB
最終ジャッジ日時 2026-06-11 21:54:40
合計ジャッジ時間 8,091 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 1
other TLE * 1 -- * 11
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#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