結果
問題 | No.1140 EXPotentiaLLL! |
ユーザー | k |
提出日時 | 2020-08-05 06:45:44 |
言語 | C++17 (gcc 13.2.0 + boost 1.83.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 594 bytes |
コンパイル時間 | 2,826 ms |
コンパイル使用メモリ | 198,300 KB |
実行使用メモリ | 8,432 KB |
最終ジャッジ日時 | 2023-10-13 14:20:20 |
合計ジャッジ時間 | 6,488 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | RE | - |
testcase_01 | RE | - |
testcase_02 | RE | - |
testcase_03 | RE | - |
testcase_04 | RE | - |
testcase_05 | RE | - |
testcase_06 | RE | - |
testcase_07 | RE | - |
testcase_08 | AC | 22 ms
8,216 KB |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | RE | - |
ソースコード
#include <bits/stdc++.h> using namespace std; #define REP(i,n) for(int i=0; i<(int)(n); i++) template <size_t N> void psieve(bool (&p)[N]) { for (int i = 0; i < N; i++) p[i] = true; p[0] = p[1] = false; for (int i = 2; i * i < N; i++) { if (!p[i]) continue; for (int j = i * i; j < N; j += i) p[j] = false; } } bool prime[5000000+1]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); psieve(prime); int T; cin >> T; REP (i, T) { long long A; int P; cin >> A >> P; cout << (prime[A] ? 1 : -1) << endl; } return 0; }