結果
問題 | No.1140 EXPotentiaLLL! |
ユーザー |
|
提出日時 | 2020-07-31 22:06:22 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 277 ms / 2,000 ms |
コード長 | 434 bytes |
コンパイル時間 | 244 ms |
コンパイル使用メモリ | 31,488 KB |
実行使用メモリ | 22,792 KB |
最終ジャッジ日時 | 2024-07-06 18:17:02 |
合計ジャッジ時間 | 4,513 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 12 |
ソースコード
#include<cstdio>int vis[5000005];void preWork(int n){vis[1] = 1;for(int i = 2; i <= n; i++){if(!vis[i]){for(int j = 2*i; j <= n; j+=i) vis[j] = 1;}}}int main(){preWork(5000000);int T;scanf("%d",&T);while(T--){long long a,p;scanf("%lld%lld",&a,&p);if(vis[p]) printf("-1\n");else printf("%d\n",(a%p)!=0);}return 0;}