結果

問題 No.1140 EXPotentiaLLL!
ユーザー mmn15277198mmn15277198
提出日時 2021-06-07 22:08:04
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,421 ms / 2,000 ms
コード長 455 bytes
コンパイル時間 1,614 ms
コンパイル使用メモリ 167,348 KB
実行使用メモリ 24,832 KB
最終ジャッジ日時 2024-05-03 22:54:40
合計ジャッジ時間 16,028 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,355 ms
24,704 KB
testcase_01 AC 1,410 ms
24,704 KB
testcase_02 AC 1,421 ms
24,704 KB
testcase_03 AC 1,137 ms
24,636 KB
testcase_04 AC 954 ms
24,696 KB
testcase_05 AC 1,285 ms
24,704 KB
testcase_06 AC 1,212 ms
24,576 KB
testcase_07 AC 1,376 ms
24,832 KB
testcase_08 AC 260 ms
24,704 KB
testcase_09 AC 261 ms
24,704 KB
testcase_10 AC 263 ms
24,704 KB
testcase_11 AC 262 ms
24,676 KB
testcase_12 AC 269 ms
24,704 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
const int MX = 5500000;
int main() {
  vector<int> prime(MX , 0);
  for (int i = 2; i < MX; i++) {
    for (int j = i; j < MX; j += i) {
      prime[j]++;
    }
  }
  int t;
  cin >> t;
  while (t--) {
    long long a , p;
    cin >> a >> p;
    if (prime[p] > 1 || p == 1) {
      cout << -1 << endl;
    } else {
      if (a % p == 0) cout << 0 << endl;
      else cout << 1 << endl;
    }
  }
  return 0;
}
0