結果

問題 No.1140 EXPotentiaLLL!
ユーザー green+green+
提出日時 2020-08-01 00:22:03
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 582 bytes
コンパイル時間 675 ms
コンパイル使用メモリ 81,304 KB
実行使用メモリ 22,612 KB
最終ジャッジ日時 2023-09-21 04:06:08
合計ジャッジ時間 8,993 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 754 ms
22,328 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 112 ms
22,396 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 106 ms
22,268 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <algorithm>
#include <queue>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(x) (x).begin(), (x).end()

int main() {
    int t,k,a,p,n=5000010;
    vector<int>r(n,1);r[0]=0;r[1]=0;
    rep(i,n){
        if(r[i]==1){
            k=i*2;
            while(k<n){
                r[k]=0;
                k+=i;
            }
        }
    }
    cin>>t;
    rep(i,t){
        cin>>a>>p;
        if(r[p])cout<<1;
        else cout<<-1;
        cout<<endl;
    }
    
	return 0;
}
0