結果

問題 No.2344 (l+r)^2
ユーザー ytqm3ytqm3
提出日時 2023-06-02 09:02:47
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 392 ms / 2,000 ms
コード長 629 bytes
コンパイル時間 2,101 ms
コンパイル使用メモリ 203,696 KB
実行使用メモリ 4,736 KB
最終ジャッジ日時 2023-08-28 02:21:25
合計ジャッジ時間 3,828 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 392 ms
4,376 KB
testcase_02 AC 37 ms
4,376 KB
testcase_03 AC 37 ms
4,380 KB
testcase_04 AC 37 ms
4,376 KB
testcase_05 AC 37 ms
4,376 KB
testcase_06 AC 38 ms
4,376 KB
testcase_07 AC 25 ms
4,376 KB
testcase_08 AC 27 ms
4,380 KB
testcase_09 AC 23 ms
4,380 KB
testcase_10 AC 30 ms
4,380 KB
testcase_11 AC 19 ms
4,376 KB
testcase_12 AC 92 ms
4,736 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using i64=int64_t;

i64 solve_sub(vector<i64> A,int M){
  while(A.size()>1){
    vector<i64> B(A.size()-1);
    for(int i=0;i<A.size()-1;++i){
      B[i]=(A[i]+A[i+1])*(A[i]+A[i+1])%(1ll<<M);
    }
    A=B;
  }
  return A[0];
}

void solve(int N,int M){
  vector<i64> A(N);
  for(auto& v:A){ cin>>v; }
  if(N>=60){
    vector<i64> B(60);
    for(int k=0;k<60;++k){
      for(int i=0;i<N-59;++i){
        B[k]^=A[i+k]%2*(((N-60)&i)==i?1:0);
      }
    }
    A=B;
  }
  cout<<solve_sub(A,M)<<endl;
}

int main(){
	int T;
	cin>>T;
	while(T--){
		int N,M;
		cin>>N>>M;
		solve(N,M);
	}
}
0