結果

問題 No.1140 EXPotentiaLLL!
コンテスト
ユーザー ぷら
提出日時 2020-07-31 21:35:11
言語 C++14
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 664 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,146 ms
コンパイル使用メモリ 182,588 KB
実行使用メモリ 42,524 KB
最終ジャッジ日時 2026-03-28 06:42:12
合計ジャッジ時間 9,590 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 6 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#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