結果

問題 No.1140 EXPotentiaLLL!
ユーザー tokusakuraitokusakurai
提出日時 2020-07-31 21:30:13
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,199 bytes
コンパイル時間 2,092 ms
コンパイル使用メモリ 197,420 KB
実行使用メモリ 8,576 KB
最終ジャッジ日時 2023-09-20 21:43:08
合計ジャッジ時間 9,177 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
const ld EPS = 1e-10;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

int main(){
    int MAX = 5000000;
    bool p[MAX+1];
    fill(p, p+MAX+1, true);
    p[1] = false;
    rep2(i, 2, MAX){
        if(p[i]){
            for(int j = 2; i*j <= MAX; j++){
                p[i*j] = false;
            }
        }
    }
    int T;
    cin >> T;
    while(T--){
        int A, P;
        cin >> A >> P;
        cout << (p[P]? 1 : -1) << endl;
    }
}
0