結果

問題 No.1140 EXPotentiaLLL!
ユーザー udonmanudonman
提出日時 2020-08-09 18:20:40
言語 C++11
(gcc 11.4.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,033 bytes
コンパイル時間 722 ms
コンパイル使用メモリ 73,572 KB
実行使用メモリ 23,040 KB
最終ジャッジ日時 2024-04-15 11:20:11
合計ジャッジ時間 23,485 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 TLE -
testcase_02 AC 1,843 ms
22,912 KB
testcase_03 AC 1,547 ms
22,844 KB
testcase_04 AC 1,416 ms
22,900 KB
testcase_05 AC 1,849 ms
23,028 KB
testcase_06 AC 1,745 ms
22,836 KB
testcase_07 TLE -
testcase_08 AC 619 ms
22,796 KB
testcase_09 AC 700 ms
22,892 KB
testcase_10 AC 656 ms
23,040 KB
testcase_11 AC 623 ms
22,792 KB
testcase_12 AC 612 ms
23,028 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <numeric>
#define ll long long int
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
using namespace std;

int mx8[] = {0,0,1,-1,-1,1,-1,1};
int my8[] = {-1,1,0,0,-1,-1,1,1};
int mx4[] = {1,-1,0,0};
int my4[] = {0,0,-1,1};
const int MOD = 1000000007;

int y[5000003];


int main() {

    for(int i = 2; i <= 5000002; i++){
        for(int j = 1; j <= 5000002/i; j++){
            y[i*j]++;
        }
    }

    int t; cin >> t;
    rep(test,t){
        ll a,p;
        cin >> a >> p;
        if(y[p] == 1){
            if(a % p == 0) cout << 0 << endl;
            else cout << 1 << endl;
        }else{
            cout << -1 << endl;
        }
    }


}
0