結果

問題 No.1140 EXPotentiaLLL!
ユーザー CleyLCleyL
提出日時 2021-12-01 12:22:23
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 514 bytes
コンパイル時間 1,617 ms
コンパイル使用メモリ 63,672 KB
実行使用メモリ 8,512 KB
最終ジャッジ日時 2023-09-17 17:05:17
合計ジャッジ時間 12,561 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,254 ms
8,236 KB
testcase_01 AC 1,245 ms
8,236 KB
testcase_02 WA -
testcase_03 AC 935 ms
8,256 KB
testcase_04 AC 719 ms
8,352 KB
testcase_05 AC 1,127 ms
8,396 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 40 ms
8,392 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 38 ms
8,320 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
bool pri[5000001];
void init(){
    pri[0] = pri[1] = true;
    for(int i = 2; 5000001 > i; i++){
        if(!pri[i]){
            for(int j = i+i; 5000001 > j; j+=i){
                pri[j]=true;
            }
        }
    }
}
int main(){
    init();
    int t;cin>>t;
    for(int i = 0; t > i; i++){
        long long a;
        int p;cin>>a>>p;
        if(pri[p]){
            cout << -1 << "\n";
        }else{
            cout << 1 << "\n";
        }
        
    }
}
0