結果
問題 | No.1140 EXPotentiaLLL! |
ユーザー | nikkukun |
提出日時 | 2020-07-31 21:39:03 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 867 bytes |
コンパイル時間 | 1,464 ms |
コンパイル使用メモリ | 164,380 KB |
実行使用メモリ | 11,028 KB |
最終ジャッジ日時 | 2023-09-20 22:14:55 |
合計ジャッジ時間 | 5,401 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 224 ms
10,808 KB |
testcase_01 | AC | 192 ms
11,008 KB |
testcase_02 | AC | 227 ms
10,804 KB |
testcase_03 | AC | 159 ms
10,916 KB |
testcase_04 | AC | 132 ms
10,912 KB |
testcase_05 | AC | 191 ms
10,820 KB |
testcase_06 | WA | - |
testcase_07 | AC | 249 ms
10,908 KB |
testcase_08 | AC | 37 ms
10,876 KB |
testcase_09 | AC | 37 ms
10,744 KB |
testcase_10 | AC | 37 ms
10,748 KB |
testcase_11 | WA | - |
testcase_12 | WA | - |
ソースコード
// #include <bits/stdc++.h> using namespace std; #define fi first #define se second #define all(x) x.begin(), x.end() #define lch (o << 1) #define rch (o << 1 | 1) typedef double db; typedef long long ll; typedef unsigned int ui; typedef pair<int, int> pint; typedef tuple<int, int, int> tint; const int N = 5e6 + 5; const int INF = 0x3f3f3f3f; const ll INF_LL = 0x3f3f3f3f3f3f3f3f; bool notPri[N]; int pri[N]; void Sieve() { notPri[0] = 1; for (int i = 2; i < N; i++) { if (!notPri[i]) { pri[++pri[0]] = i; } for (int j = 1; j <= pri[0]; j++) { int p = pri[j]; if (i * p >= N) break; notPri[i * p] = 1; if (i % p == 0) break; } } } int main() { Sieve(); int t; scanf("%d", &t); while (t--) { ll a; int p; scanf("%lld%d", &a, &p); if (notPri[p]) printf("-1\n"); else printf("%d\n", (a % p != 0)); } return 0; }