結果
問題 | No.1140 EXPotentiaLLL! |
ユーザー | Sooh31 |
提出日時 | 2020-08-19 11:50:05 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 707 bytes |
コンパイル時間 | 2,311 ms |
コンパイル使用メモリ | 193,524 KB |
実行使用メモリ | 11,268 KB |
最終ジャッジ日時 | 2024-04-20 08:16:37 |
合計ジャッジ時間 | 13,902 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1,081 ms
10,276 KB |
testcase_01 | AC | 1,110 ms
11,248 KB |
testcase_02 | AC | 1,095 ms
11,268 KB |
testcase_03 | AC | 833 ms
10,056 KB |
testcase_04 | AC | 626 ms
9,952 KB |
testcase_05 | AC | 975 ms
9,752 KB |
testcase_06 | WA | - |
testcase_07 | AC | 1,082 ms
9,692 KB |
testcase_08 | AC | 40 ms
9,848 KB |
testcase_09 | AC | 40 ms
9,652 KB |
testcase_10 | AC | 40 ms
10,580 KB |
testcase_11 | WA | - |
testcase_12 | WA | - |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; using Graph = vector<vector<int>>; const ll mod = 1000000007; const int INF = 1001001001; bool is_prime[10000000]; void init(){ for(int i = 0; i < 6000000; i++){ is_prime[i] = true; } for(int i = 2; i < 6000000; i++){ if(!is_prime[i]) continue; for(int j = 2; i*j < 6000000; j++){ is_prime[i*j] = false; } } } int main(){ int t; cin >> t; init(); while(t--){ ll a, p; cin >> a >> p; if(!is_prime[p]){ cout << -1 << endl; continue; } if(a % p == 0) cout << 0 << endl; else cout << 1 << endl; } }