結果
| 問題 |
No.2344 (l+r)^2
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-06-10 18:19:04 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 69 ms / 2,000 ms |
| コード長 | 809 bytes |
| コンパイル時間 | 1,710 ms |
| コンパイル使用メモリ | 164,728 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2025-01-02 23:43:07 |
| 合計ジャッジ時間 | 2,999 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 12 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int T;
cin >> T;
while(T--){
int n, m;
cin >> n >> m;
vector<ll> a(n);
for(auto &&v : a) cin >> v;
ll S = (1 << m) - 1, d = n - m;
if(n > m){
vector<ll> 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';
}
}