結果

問題 No.1140 EXPotentiaLLL!
コンテスト
ユーザー keisuke6
提出日時 2022-07-12 22:07:06
言語 C++23
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
TLE  
実行時間 -
コード長 509 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 4,552 ms
コンパイル使用メモリ 360,072 KB
実行使用メモリ 19,400 KB
最終ジャッジ日時 2026-03-09 02:47:48
合計ジャッジ時間 29,437 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 5 TLE * 7
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define int long long
bool Isprime(int N){
  bool ok = (N != 1);
  for(int i=2;i*i<=N;i++){
    if(N%i == 0) ok = false;
  }
  return ok;
}
signed main(){
  int T;
  cin>>T;
  for(int i=0;i<T;i++){
      int A,P;
      cin>>A>>P;
      if(!Isprime(P)){
          cout<<-1<<endl;
          continue;
      }
      if(A%P == 0) cout<<0<<endl;
      else cout<<1<<endl;
  }
}
0