結果

問題 No.1140 EXPotentiaLLL!
ユーザー ぷらぷら
提出日時 2020-07-31 21:35:11
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 664 bytes
コンパイル時間 1,515 ms
コンパイル使用メモリ 164,908 KB
実行使用メモリ 42,340 KB
最終ジャッジ日時 2023-09-20 22:04:59
合計ジャッジ時間 14,512 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,306 ms
41,948 KB
testcase_01 AC 1,311 ms
42,240 KB
testcase_02 WA -
testcase_03 AC 1,032 ms
42,124 KB
testcase_04 AC 802 ms
42,176 KB
testcase_05 AC 1,191 ms
42,164 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 149 ms
42,164 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 133 ms
42,172 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e16+7;
int mod = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
    vector<int>cnt(5000005,true);
    cnt[0] = cnt[1] = false;
    for(int i = 2; i <= 5000005; i++) {
        if(!cnt[i]) {
            continue;
        }
        for(int j = i*2; j <= 5000005; j+=i) {
            cnt[j] = false;
        }
    }
    int T;
    cin >> T;
    for(int i = 0; i < T; i++) {
        int A,P;
        cin >> A >> P;
        if(!cnt[P]) {
            cout << -1 << endl;
            continue;
        }
        cout << 1 << endl;
    }
}
0