結果

問題 No.2344 (l+r)^2
ユーザー 👑 NachiaNachia
提出日時 2023-06-09 21:24:36
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,947 bytes
コンパイル時間 773 ms
コンパイル使用メモリ 78,560 KB
実行使用メモリ 4,628 KB
最終ジャッジ日時 2023-08-30 12:51:54
合計ジャッジ時間 1,848 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 61 ms
4,376 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 8 ms
4,376 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#line 1 "..\\Main.cpp"
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <atcoder/modint>
#line 4 "D:\\Programming\\VSCode\\competitive-cpp\\nachia\\misc\\bit-operations.hpp"

namespace nachia{

int Popcount(unsigned long long c) noexcept {
#ifdef __GNUC__
    return __builtin_popcountll(c);
#else
    c = (c & (~0ull/3)) + ((c >> 1) & (~0ull/3));
    c = (c & (~0ull/5)) + ((c >> 2) & (~0ull/5));
    c = (c & (~0ull/17)) + ((c >> 4) & (~0ull/17));
    c = (c * (~0ull/257)) >> 56;
    return c;
#endif
}

// please ensure x != 0
int MsbIndex(unsigned long long x) noexcept {
#ifdef __GNUC__
    return 63 - __builtin_clzll(x);
#else
    int res = 0;
    for(int d=32; d>0; d>>=1) if(x >> d){ res |= d; x >>= d; }
    return res;
#endif
}

// please ensure x != 0
int LsbIndex(unsigned long long x) noexcept {
#ifdef __GNUC__
    return __builtin_ctzll(x);
#else
    return MsbIndex(x & -x);
#endif
}

}

#line 7 "..\\Main.cpp"
using namespace std;
using i32 = int;
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
const i64 INF = 1001001001001001001;

using Modint = atcoder::static_modint<998244353>;



int main(){
    int T; cin >> T;
    rep(t,T){
        int N; cin >> N;
        int M; cin >> M;
        vector<i64> A(N); rep(i,N) cin >> A[i];
        if(M * 2 + 2 <= N){
            int res = 0;
            rep(i,N) if(nachia::Popcount(i & (N-1)) % 2 == 0) res ^= (A[i] & 1);
            cout << res << '\n';
        }
        else{
            for(int j=N-1; j>=1; j--) for(int k=0; k<j; k++){
                A[k] = (A[k] + A[k+1]) * (A[k] + A[k+1]);
                A[k] &= (1ll << M) - 1;
            }
            cout << A[0] << '\n';
        }
    }
    return 0;
}



struct ios_do_not_sync{
    ios_do_not_sync(){
        ios::sync_with_stdio(false);
        cin.tie(nullptr);
    }
} ios_do_not_sync_instance;

0