結果

問題 No.1140 EXPotentiaLLL!
ユーザー chielochielo
提出日時 2020-07-31 21:29:45
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 562 bytes
コンパイル時間 1,450 ms
コンパイル使用メモリ 164,780 KB
実行使用メモリ 18,064 KB
最終ジャッジ日時 2023-09-20 21:41:44
合計ジャッジ時間 6,106 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 239 ms
17,796 KB
testcase_01 AC 240 ms
17,788 KB
testcase_02 WA -
testcase_03 AC 212 ms
17,720 KB
testcase_04 AC 183 ms
17,732 KB
testcase_05 AC 238 ms
17,728 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 86 ms
17,784 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

const int maxp = 1e7 + 3;

int p[maxp], pl;
bool isc[maxp];

int main() {
    for(int i = 2; i < maxp; ++i) {
        if(!isc[i])
            p[pl++] = i;
        for(int j = 0; j < pl && i * (long long)p[j] < maxp; ++j) {
            isc[i * p[j]] = true;
            if(i % p[j] == 0)
                break;
        }
    }
    int t;
    scanf("%d", &t);
    while(t--) {
        long long a; int p;
        scanf("%lld%d", &a, &p);
        if(isc[p])
            puts("-1");
        else
            puts("1");
    }
    return 0;
}
0