結果
問題 | No.1140 EXPotentiaLLL! |
ユーザー | carrot46 |
提出日時 | 2020-08-08 13:04:47 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 307 ms / 2,000 ms |
コード長 | 888 bytes |
コンパイル時間 | 1,713 ms |
コンパイル使用メモリ | 165,060 KB |
実行使用メモリ | 42,596 KB |
最終ジャッジ日時 | 2024-04-09 02:13:28 |
合計ジャッジ時間 | 7,707 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 291 ms
42,424 KB |
testcase_01 | AC | 248 ms
42,420 KB |
testcase_02 | AC | 288 ms
42,368 KB |
testcase_03 | AC | 233 ms
42,596 KB |
testcase_04 | AC | 193 ms
42,560 KB |
testcase_05 | AC | 259 ms
42,384 KB |
testcase_06 | AC | 256 ms
42,364 KB |
testcase_07 | AC | 307 ms
42,432 KB |
testcase_08 | AC | 99 ms
42,568 KB |
testcase_09 | AC | 106 ms
42,476 KB |
testcase_10 | AC | 101 ms
42,592 KB |
testcase_11 | AC | 106 ms
42,520 KB |
testcase_12 | AC | 101 ms
42,452 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; #define reps(i,s,n) for(int i = s; i < n; i++) #define rep(i,n) reps(i,0,n) #define Rreps(i,n,e) for(int i = n - 1; i >= e; --i) #define Rrep(i,n) Rreps(i,n,0) #define ALL(a) a.begin(), a.end() #define fi first #define se second typedef long long ll; typedef vector<ll> vec; typedef vector<vec> mat; ll N,M,H,W,Q,K,A,B; string S; //const ll MOD = 998244353; const ll MOD = (1e+9) + 7; typedef pair<ll, ll> P; const ll INF = (1LL<<58); int main() { const ll max_P = ll(5e+6) + 10; vec memo(max_P, 1); memo[1] = 0; reps(i, 2, max_P){ if(memo[i]){ for(int j = i * 2; j < max_P; j += i) memo[j] = 0; } } cin>>N; rep(i,N){ scanf("%lld %lld", &A, &K); if(memo[K]){ printf("%d\n", (A%K == 0 ? 0 : 1)); }else{ printf("-1\n"); } } }