結果
問題 | No.36 素数が嫌い! |
ユーザー | 久我山菜々 |
提出日時 | 2018-11-19 22:20:34 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 617 bytes |
コンパイル時間 | 690 ms |
コンパイル使用メモリ | 83,952 KB |
実行使用メモリ | 10,624 KB |
最終ジャッジ日時 | 2023-08-26 02:07:37 |
合計ジャッジ時間 | 4,554 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 80 ms
9,728 KB |
testcase_01 | AC | 80 ms
8,608 KB |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | AC | 87 ms
8,612 KB |
testcase_08 | AC | 80 ms
8,780 KB |
testcase_09 | AC | 80 ms
9,576 KB |
testcase_10 | AC | 80 ms
9,220 KB |
testcase_11 | AC | 88 ms
8,916 KB |
testcase_12 | AC | 86 ms
8,748 KB |
testcase_13 | WA | - |
testcase_14 | AC | 80 ms
8,556 KB |
testcase_15 | AC | 80 ms
9,032 KB |
testcase_16 | WA | - |
testcase_17 | AC | 89 ms
9,952 KB |
testcase_18 | AC | 82 ms
9,500 KB |
testcase_19 | AC | 80 ms
8,820 KB |
testcase_20 | AC | 80 ms
9,296 KB |
testcase_21 | AC | 80 ms
9,228 KB |
testcase_22 | AC | 81 ms
8,840 KB |
testcase_23 | AC | 80 ms
8,700 KB |
testcase_24 | AC | 81 ms
9,612 KB |
testcase_25 | AC | 80 ms
9,688 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 == 0) { std::cout << "YES" << std::endl; return 0; } } std::cout << "NO" << std::endl; }