結果

問題 No.3023 素数判定するだけ
ユーザー みしあみしあ
提出日時 2021-10-22 12:43:18
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,329 bytes
コンパイル時間 1,786 ms
コンパイル使用メモリ 76,724 KB
実行使用メモリ 4,372 KB
最終ジャッジ日時 2023-10-23 20:48:22
合計ジャッジ時間 6,879 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <utility>
#include <vector>
#include <numeric>
using namespace std;

using ll = long long;

const ll t = true, f = false, tt = t << t;

ll ad(ll a, ll b){
    vector<ll> tmp{a};
    return accumulate(tmp.begin(), tmp.end(), b);
}

ll mn(ll a, ll b){
    return ad(a, ad(~b, t));
}

template<class... Args>
ll Num(Args... args){
    ll ret = f;
    for(auto v : initializer_list<ll>{args...}){
        ret <<= t;
        ret |= v;
    }
    return ret;
}

ll mm(ll a, ll b){
    ll ret = f;
    if(a>b){
        swap(a, b);
    }
    while(a){
        if(a&t){
            ret = ad(ret, b);
        }
        b <<= t;
        a >>= t;
    }
    return ret;
}

ll pp(ll a, ll b){
    ll x = ad(a, b);
    return x;
}

bool isprime(ll N){
    vector<bool> XS(N<<t, true);
    XS[f] = XS[t] = f;
    for(int i=tt; i<N; i=ad(i, t)){
        if(!XS[i]) continue;
        ll c = i;
        for(ll c = i<<t; c <= N; c = ad(c, i)){
            XS[c] = f;
        }
    }
    return XS[N];
}

int main(){
    ll N;
    cin >> N;
    if(isprime(N)){
        cout << (char)Num(t,f,t,t,f,f,t);
        cout << (char)Num(t,f,f,f,t,f,t);
        cout << (char)Num(t,f,t,f,f,t,t);
    }else{
        cout << (char)Num(t,f,f,t,t,t,f);
        cout << (char)Num(t,f,f,t,t,t,t);
    }
    cout << endl;
    return f;
}
0