結果
問題 | No.36 素数が嫌い! |
ユーザー | 久我山菜々 |
提出日時 | 2018-11-19 22:21:52 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 694 bytes |
コンパイル時間 | 727 ms |
コンパイル使用メモリ | 83,916 KB |
実行使用メモリ | 10,548 KB |
最終ジャッジ日時 | 2023-08-26 02:07:47 |
合計ジャッジ時間 | 4,410 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 80 ms
9,164 KB |
testcase_01 | AC | 81 ms
9,228 KB |
testcase_02 | AC | 80 ms
8,364 KB |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | AC | 87 ms
9,416 KB |
testcase_08 | AC | 80 ms
9,032 KB |
testcase_09 | AC | 79 ms
9,032 KB |
testcase_10 | AC | 80 ms
9,220 KB |
testcase_11 | AC | 87 ms
8,584 KB |
testcase_12 | AC | 88 ms
9,404 KB |
testcase_13 | WA | - |
testcase_14 | AC | 81 ms
9,464 KB |
testcase_15 | AC | 81 ms
9,620 KB |
testcase_16 | AC | 81 ms
9,240 KB |
testcase_17 | AC | 87 ms
8,636 KB |
testcase_18 | AC | 80 ms
9,296 KB |
testcase_19 | AC | 81 ms
10,088 KB |
testcase_20 | AC | 81 ms
9,936 KB |
testcase_21 | AC | 80 ms
10,096 KB |
testcase_22 | AC | 81 ms
9,156 KB |
testcase_23 | AC | 80 ms
9,184 KB |
testcase_24 | AC | 80 ms
9,440 KB |
testcase_25 | AC | 80 ms
9,200 KB |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
ソースコード
#include<iostream> #include<vector> #include<map> #include<algorithm> #include<bitset> static int const MAX = 10000000 + 1; std::vector<int> primes() { std::vector<int> rs; std::bitset<MAX> ps; ps.set(); ps[0] = ps[1] = 0; for(int i{2}; i < MAX; ++i) { if(!ps[i]) continue; rs.push_back(i); for(int j{i * 2}; j < MAX; j += i) { ps[j] = 0; } } return rs; } int main(int, char**) { long long n; std::cin >> n; auto ps = primes(); for(auto e: ps) { if(n == e) { std::cout << "NO" << std::endl; return 0; } if(n % e == 0) { std::cout << "YES" << std::endl; return 0; } } std::cout << "NO" << std::endl; }