結果
問題 | No.1140 EXPotentiaLLL! |
ユーザー | nikkukun |
提出日時 | 2020-07-31 21:41:59 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 257 ms / 2,000 ms |
コード長 | 867 bytes |
コンパイル時間 | 1,530 ms |
コンパイル使用メモリ | 163,672 KB |
実行使用メモリ | 11,036 KB |
最終ジャッジ日時 | 2023-09-20 22:23:26 |
合計ジャッジ時間 | 5,530 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge13 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 224 ms
10,872 KB |
testcase_01 | AC | 192 ms
10,824 KB |
testcase_02 | AC | 228 ms
10,888 KB |
testcase_03 | AC | 169 ms
10,880 KB |
testcase_04 | AC | 139 ms
10,936 KB |
testcase_05 | AC | 202 ms
10,832 KB |
testcase_06 | AC | 193 ms
10,948 KB |
testcase_07 | AC | 257 ms
10,876 KB |
testcase_08 | AC | 37 ms
10,804 KB |
testcase_09 | AC | 38 ms
11,036 KB |
testcase_10 | AC | 38 ms
11,000 KB |
testcase_11 | AC | 37 ms
10,972 KB |
testcase_12 | AC | 38 ms
10,940 KB |
ソースコード
// #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[1] = 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; }