結果

問題 No.2344 (l+r)^2
ユーザー maksimmaksim
提出日時 2023-06-09 21:22:55
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,241 bytes
コンパイル時間 1,584 ms
コンパイル使用メモリ 169,704 KB
実行使用メモリ 11,444 KB
最終ジャッジ日時 2023-08-30 12:50:46
合計ジャッジ時間 5,853 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
#define int long long
vector<int> op(vector<int> a,int m)
{
    for(int i=0;i<a.size()-1;++i)
    {
        a[i]=((a[i]+a[i+1])*(a[i]+a[i+1]))%(1LL<<m);
    }
    a.pop_back();
    return a;
}
int f(int n)
{
    int res=0;
    while(n)
    {
        res+=(n/2);n/=2;
    }
    return res;
}
int32_t main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int t;cin>>t;
    while(t--)
    {
        int n,m;cin>>n>>m;
        int a[n];for(int i=0;i<n;++i) cin>>a[i];
        vector<int> b(n);for(int i=0;i<n;++i) b[i]=a[i]%2;
        vector<int> c(n);
        if(n<=32)
        {
            vector<int> a1(n);for(int i=0;i<n;++i) a1[i]=a[i];
            while(a1.size()>1) a1=op(a1,m);
            cout<<a1[0]<<'\n';continue;
        }
        else
        {
            vector<int> a1(n);
            for(int j=0;j<32;++j)
            {
                for(int i=0;i<=n-32;++i)
                {
                    if(f(i)+f(n-32-i)==f(n-32))
                    {
                        a1[j]^=a[i+j];
                    }
                }
            }
            while(a1.size()>1) a1=op(a1,m);
            cout<<a1[0]<<'\n';continue;
        }
    }
    return 0;
}
0