結果

問題 No.1140 EXPotentiaLLL!
ユーザー ShibuyapShibuyap
提出日時 2020-07-31 21:28:18
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,173 bytes
コンパイル時間 1,988 ms
コンパイル使用メモリ 200,640 KB
実行使用メモリ 48,144 KB
最終ジャッジ日時 2023-09-20 21:37:15
合計ジャッジ時間 16,819 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,429 ms
46,476 KB
testcase_01 AC 1,419 ms
46,744 KB
testcase_02 WA -
testcase_03 AC 1,124 ms
47,840 KB
testcase_04 AC 921 ms
47,016 KB
testcase_05 AC 1,362 ms
47,008 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 253 ms
48,144 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 246 ms
46,492 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}


/*
    Max_Prime以下の素数をprimes[]に格納
*/

const int Max_Prime = 10000000;
int tmp_primes[Max_Prime];
vector<int> primes;

void PrimeInit() {
    rep(i,Max_Prime)tmp_primes[i] = 1;
    tmp_primes[0] = 0;
    tmp_primes[1] = 0;

    rep(i,Max_Prime){
        if(tmp_primes[i] == 0)continue;
        int j = 2;
        while(i * j < Max_Prime){
            tmp_primes[i*j] = 0;
            j++;
        }
    }
    
    rep(i,Max_Prime){
        if(tmp_primes[i])primes.push_back(i);
    }
}


int main() {
    PrimeInit();
    int T;
    cin >> T;
    rep(_,T){
        ll a, p;
        cin >> a >> p;
        auto ite = lower_bound(primes.begin(), primes.end(), p);
        if(*ite != p){
            cout << -1 << endl;
            continue;
        }else{
            cout << 1 << endl;
        }

    }
    return 0;
}
 
 
0