結果

問題 No.2344 (l+r)^2
ユーザー t98slidert98slider
提出日時 2023-06-10 18:20:54
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 53 ms / 2,000 ms
コード長 822 bytes
コンパイル時間 1,707 ms
コンパイル使用メモリ 167,744 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-30 23:44:15
合計ジャッジ時間 2,840 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    uint T;
    cin >> T;
    while(T--){
        uint n, m;
        cin >> n >> m;
        vector<uint> a(n);
        for(auto &&v : a) cin >> v;
        uint S = (1 << m) - 1, d = n - m;
        if(n > m){
            vector<uint> b(m);
            for(int i = 0; i < m; i++){
                for(int j = 0; j <= d; j++){
                    b[i] ^= ((d & j) == j ? a[i + j] & 1 : 0);
                }
            }
            swap(a, b);
        }
        while(a.size() >= 2){
            for(int i = 0; i + 1 < a.size(); i++){
                a[i] = (a[i] + a[i + 1]) * (a[i] + a[i + 1]) & S;
            }
            a.pop_back();
        }
        cout << a[0] << '\n';
    }
}
0