結果

問題 No.1140 EXPotentiaLLL!
ユーザー zumin
提出日時 2021-03-25 22:17:48
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 599 bytes
コンパイル時間 910 ms
コンパイル使用メモリ 70,400 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-27 07:36:53
合計ジャッジ時間 13,249 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 6 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>

using namespace std;

int main(){
    int t;
    cin>>t;
    vector<bool> prime(10010010,true);
    prime[0]=false;
    prime[1]=false;

    for(int i=2;i*i<=10010010;i++){
        if(!prime[i]) continue;
        for(int j=i*i;j<=10010010;j+=i){
            prime[j]=false;
        }
    }
    for(int i=0;i<t;i++){
        long long a,p;
        cin>>a>>p;
        if(!prime[p]){
            cout<<-1<<endl;
            continue;
        }
        if(a==p){
            cout<<0<<endl;
        }else{
            cout<<1<<endl;
        }

    }
    return 0;
}
0