結果

問題 No.2344 (l+r)^2
ユーザー i_am_noobi_am_noob
提出日時 2023-06-24 00:37:43
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 56 ms / 2,000 ms
コード長 807 bytes
コンパイル時間 2,333 ms
コンパイル使用メモリ 199,968 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-13 19:48:40
合計ジャッジ時間 3,992 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using pii=pair<int,int>;

#define all(a) a.begin(),a.end()
#define pb push_back
#define sz(a) ((int)a.size())

const int N=200005,M=35;
int n,m;
unsigned a[N],b[N];

void ahcorz(){
    cin >> n >> m;
    for(int i=0; i<n; ++i) cin >> a[i];
    if(n>=M){
        for(int i=0; i<M; ++i){
            b[i]=0;
            for(int j=0; j<=n-M; ++j) if(((n-M)&j)==j) b[i]^=a[i+j]&1;
        }
        for(int i=0; i<M; ++i) a[i]=b[i];
        n=M;
    }
    for(int j=0; j<n-1; ++j){
        for(int i=0; i<n-j-1; ++i) b[i]=(a[i]+a[i+1])*(a[i]+a[i+1]);
        for(int i=0; i<n-j-1; ++i) a[i]=b[i];
    }
    cout << a[0]%(1<<m) << "\n";
}

signed main(){
    ios_base::sync_with_stdio(0),cin.tie(0);
    int t; cin >> t;
    while(t--) ahcorz();
}
0