結果
問題 | No.1140 EXPotentiaLLL! |
ユーザー | どらら |
提出日時 | 2020-08-01 00:52:08 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 840 bytes |
コンパイル時間 | 1,455 ms |
コンパイル使用メモリ | 164,068 KB |
実行使用メモリ | 9,440 KB |
最終ジャッジ日時 | 2023-09-21 04:33:01 |
合計ジャッジ時間 | 13,281 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1,208 ms
9,184 KB |
testcase_01 | AC | 1,202 ms
9,272 KB |
testcase_02 | WA | - |
testcase_03 | AC | 919 ms
9,144 KB |
testcase_04 | AC | 705 ms
9,188 KB |
testcase_05 | AC | 1,105 ms
9,220 KB |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | AC | 50 ms
9,272 KB |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | AC | 49 ms
9,136 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; #define REP(i,a,n) for(int i=(a); i<(int)(n); i++) #define rep(i,n) REP(i,0,n) #define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it) #define ALLOF(c) (c).begin(), (c).end() typedef long long ll; typedef unsigned long long ull; #define MAX_PRIME 6000000 bool isprime[MAX_PRIME+1]; void init_prime(){ fill(isprime, isprime+MAX_PRIME+1, true); isprime[0] = isprime[1] = false; for(int i = 2; i <= MAX_PRIME; i++) { if (isprime[i]) { for(int j = i*2; j <= MAX_PRIME; j += i) isprime[j] = false; } } } int main(){ init_prime(); int T; cin >> T; rep(t,T){ ll A, P; cin >> A >> P; if(!isprime[P]) cout << -1 << endl; else{ if(A==0) cout << 0 << endl; else cout << 1 << endl; } } return 0; }