結果

問題 No.1140 EXPotentiaLLL!
コンテスト
ユーザー yakki
提出日時 2020-07-31 21:41:28
言語 C++17
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
TLE  
実行時間 -
コード長 1,062 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 795 ms
コンパイル使用メモリ 138,760 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-06-11 20:31:19
合計ジャッジ時間 21,630 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 4 WA * 5 TLE * 3
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
#include<cstdio>
#include<cstdlib>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

const double EPS = 1e-10;

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;

bool is_prime(int n){
    if(n == 1) return false;
    bool ok = true;
    for(int i = 2; i*i <= n; i++){
        if(n%i == 0) ok = false;
    }
    return ok;
}

int main(){
    int t; cin >> t;
    while(t--){
        ll a; cin >> a;
        int p; cin >> p;
        if(!is_prime(p)){
            cout << -1 << "\n";
        }
        else{
            if(a == p) cout << 0 << "\n";
            else cout << 1 << "\n";
        }
    }
} 

0