結果

問題 No.1140 EXPotentiaLLL!
ユーザー catuppercatupper
提出日時 2020-07-31 21:28:16
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 997 bytes
コンパイル時間 717 ms
コンパイル使用メモリ 82,312 KB
実行使用メモリ 9,104 KB
最終ジャッジ日時 2023-09-20 21:36:28
合計ジャッジ時間 4,117 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 177 ms
8,808 KB
testcase_01 AC 177 ms
8,808 KB
testcase_02 WA -
testcase_03 AC 141 ms
8,748 KB
testcase_04 AC 112 ms
8,752 KB
testcase_05 AC 160 ms
8,816 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 24 ms
8,860 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 23 ms
8,868 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include<complex>
using namespace std;
#define MOD 1000000007
#define MOD2 998244353
#define INF (1<<29)
#define LINF (1LL<<60)
#define EPS (1e-10)
#define PI 3.1415926535897932384626433832795028
typedef long long Int;
typedef pair<Int, Int> P;
typedef long double Real;
typedef complex<Real> CP;

bool is_prime[5500000];

void init(){
    fill(is_prime, is_prime + 5500000, true);
    is_prime[0] = is_prime[1] = false;
    for(int i = 2;i*i < 5500000;i++){
        if(!is_prime[i])continue;
        for(Int j = i * i;j < 5500000;j += i)
            is_prime[j] = false;
    }
}

void solve(){
    Int a, p;
    scanf("%lld%lld", &a, &p);
    if(!is_prime[p]){
        puts("-1");     
    }
    else{
        puts("1");
    }    
}

int main(){
    Int t;
    init();
    scanf("%lld", &t);
    while(t--)solve();
    return 0;
}
0