Submission #00104
ソースコード
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | #include <bits/stdc++.h> //{ SFT using namespace std; #define int int64_t #define rep(i, a, n) for (int i = (a); i < (n); ++i) #define reps(i, a, n) for (int i = (a); i > (n); --i) #define arep(i, a) for (auto &&i : (a)) #define irep(i, x) for (auto i = (x).begin(); i != (x).end(); ++i) #define size(x) ((int)(x).size()) //降順はgreater<T>() #define all(x) (x).begin(), (x).end() #define rv(s) reverse((s).begin(), (s).end()) //gcd lcmはそのままok #define gcd(a, b) __gcd(a, b) #define bit(n) (1LL << (n)) #define bits(n) bitset(n) #define pcnt(x) __builitin_popcountll(x) //配列内等要素削除 #define unique(x) (x).erase(unique(x).begin(),(x).end()),(x).end()); #define Fixed(n) fixed << setprecision(n) //総和 #define sowa(n) ((n) * ((n) + 1)) / 2 #define pb(x, a) (x).push_back(a) #define fb(x, a) (x).flont_back(a) #define eb(x, a) (x).emplaes_back(a) #define F first #define S second #define cauto (const auto &) template < class A, class B> using pii = vector<pair<A, B>>; //昇順 template < class T> using min_heap = priority_queue<T, vector<T>, greater<T>>; //降順 template < class T> using max_heap = priority_queue<T>; template < class A, class B> using umap = unordered_map<A, B>; template < class A> using uset = unordered_set<A>; template < class T> bool chmax(T &a, const T &b) //最大値更新 返り値はbool { if (a < b) { a = b; return 1; } return 0; } template < class T> bool chmin(T &a, const T &b) //最小値更新 返り値はbool { if (b < a) { a = b; return 1; } return 0; } int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, 1, 0, -1}; constexpr int INF = 0x3f3f3f3f; constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL; constexpr long long mod1 = 1e9 + 7; constexpr long long mod2 = 998244353; template < size_t max_N, size_t prime_size> struct Prime { bool sieve[max_N]; int_fast64_t prime[prime_size]; size_t counter = 0; constexpr Prime() : sieve(), prime() { for (int_fast64_t i = 0; i < max_N; ++i) sieve[i] = true ; sieve[0] = sieve[1] = false ; for (int_fast64_t i = 2; i < max_N; ++i) { if (sieve[i]) { prime[counter] = i; ++counter; if (counter > prime_size) break ; } for (int_fast64_t j = i * i; j < max_N; j += i) sieve[j] = false ; } } }; //} END auto p = Prime<600000, 5999993>(); signed main() { cin.tie(nullptr); ios_base::sync_with_stdio( false ); int n; cin>>n; vector< int > x(n); rep(i,0,n){ cin>>x[i]; if (p.sieve[x[i]] == true ){ cout<<1<< '\n' ; } else { cout<< "NA\n" ; } } return 0; } |
ステータス
項目 | データ |
---|---|
問題 | 0005 - 掛けても素数!? |
ユーザー名 | immunity |
投稿日時 | 2020-04-25 22:26:57 |
言語 | C++17 |
状態 | Wrong Answer |
得点 | 0 |
ソースコード長 | 2902 Byte |
最大実行時間 | 191 ms |
最大メモリ使用量 | 102036 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 0 / 300 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
in01.txt | WA | 42 ms | 48088 KB |
1
|
in02.txt | WA | 34 ms | 47928 KB |
1
|
in03.txt | WA | 35 ms | 47896 KB |
1
|
in04.txt | WA | 32 ms | 48000 KB |
1
|
in05.txt | WA | 31 ms | 48100 KB |
1
|
in06.txt | WA | 64 ms | 50124 KB |
1
|
in07.txt | WA | 122 ms | 59128 KB |
1
|
in08.txt | WA | 121 ms | 60136 KB |
1
|
in09.txt | WA | 99 ms | 62448 KB |
1
|
in10.txt | WA | 143 ms | 66768 KB |
1
|
in11.txt | WA | 146 ms | 69680 KB |
1
|
in12.txt | WA | 150 ms | 72716 KB |
1
|
in13.txt | WA | 191 ms | 75500 KB |
1
|
in14.txt | WA | 156 ms | 78412 KB |
1
|
in15.txt | WA | 146 ms | 81320 KB |
1
|
in16.txt | WA | 68 ms | 77960 KB |
1
|
in17.txt | WA | 105 ms | 85464 KB |
1
|
in18.txt | WA | 108 ms | 88500 KB |
1
|
in19.txt | WA | 108 ms | 91412 KB |
1
|
in20.txt | AC | 110 ms | 94324 KB |
1
|
in21.txt | WA | 101 ms | 97236 KB |
1
|
in22.txt | AC | 108 ms | 99124 KB |
1
|
in23.txt | WA | 113 ms | 102036 KB |
1
|
in24.txt | WA | 29 ms | 94192 KB |
1
|
in25.txt | AC | 37 ms | 94300 KB |
1
|
in26.txt | AC | 31 ms | 94156 KB |
1
|
sample01.txt | AC | 38 ms | 94140 KB |
1
|