結果
問題 | No.1140 EXPotentiaLLL! |
ユーザー | zumin |
提出日時 | 2021-03-25 22:17:48 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 599 bytes |
コンパイル時間 | 581 ms |
コンパイル使用メモリ | 69,216 KB |
実行使用メモリ | 4,656 KB |
最終ジャッジ日時 | 2023-08-18 04:57:11 |
合計ジャッジ時間 | 12,078 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1,217 ms
4,656 KB |
testcase_01 | AC | 1,214 ms
4,376 KB |
testcase_02 | WA | - |
testcase_03 | AC | 891 ms
4,596 KB |
testcase_04 | AC | 680 ms
4,380 KB |
testcase_05 | AC | 1,060 ms
4,380 KB |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | AC | 39 ms
4,376 KB |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | AC | 38 ms
4,384 KB |
ソースコード
#include <iostream> #include <vector> using namespace std; int main(){ int t; cin>>t; vector<bool> prime(10010010,true); prime[0]=false; prime[1]=false; for(int i=2;i*i<=10010010;i++){ if(!prime[i]) continue; for(int j=i*i;j<=10010010;j+=i){ prime[j]=false; } } for(int i=0;i<t;i++){ long long a,p; cin>>a>>p; if(!prime[p]){ cout<<-1<<endl; continue; } if(a==p){ cout<<0<<endl; }else{ cout<<1<<endl; } } return 0; }