結果

問題 No.1210 XOR Grid
ユーザー ytftytft
提出日時 2021-05-13 03:13:38
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 310 ms / 2,000 ms
コード長 2,394 bytes
コンパイル時間 5,070 ms
コンパイル使用メモリ 387,060 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-24 21:18:15
合計ジャッジ時間 12,230 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 1 ms
4,348 KB
testcase_14 AC 1 ms
4,348 KB
testcase_15 AC 1 ms
4,348 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 2 ms
4,348 KB
testcase_18 AC 2 ms
4,348 KB
testcase_19 AC 2 ms
4,348 KB
testcase_20 AC 2 ms
4,348 KB
testcase_21 AC 2 ms
4,348 KB
testcase_22 AC 2 ms
4,348 KB
testcase_23 AC 2 ms
4,348 KB
testcase_24 AC 2 ms
4,348 KB
testcase_25 AC 155 ms
4,348 KB
testcase_26 AC 153 ms
4,348 KB
testcase_27 AC 152 ms
4,348 KB
testcase_28 AC 153 ms
4,348 KB
testcase_29 AC 153 ms
4,348 KB
testcase_30 AC 112 ms
4,348 KB
testcase_31 AC 153 ms
4,348 KB
testcase_32 AC 155 ms
4,348 KB
testcase_33 AC 2 ms
4,348 KB
testcase_34 AC 2 ms
4,348 KB
testcase_35 AC 2 ms
4,348 KB
testcase_36 AC 32 ms
4,348 KB
testcase_37 AC 31 ms
4,348 KB
testcase_38 AC 31 ms
4,348 KB
testcase_39 AC 30 ms
4,348 KB
testcase_40 AC 61 ms
4,348 KB
testcase_41 AC 61 ms
4,348 KB
testcase_42 AC 307 ms
4,348 KB
testcase_43 AC 247 ms
4,348 KB
testcase_44 AC 310 ms
4,348 KB
testcase_45 AC 310 ms
4,348 KB
testcase_46 AC 296 ms
4,348 KB
testcase_47 AC 67 ms
4,348 KB
testcase_48 AC 66 ms
4,348 KB
testcase_49 AC 2 ms
4,348 KB
testcase_50 AC 134 ms
4,348 KB
testcase_51 AC 304 ms
4,348 KB
testcase_52 AC 257 ms
4,348 KB
testcase_53 AC 303 ms
4,348 KB
testcase_54 AC 67 ms
4,348 KB
testcase_55 AC 172 ms
4,348 KB
testcase_56 AC 155 ms
4,348 KB
testcase_57 AC 147 ms
4,348 KB
testcase_58 AC 2 ms
4,348 KB
testcase_59 AC 1 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <boost/multiprecision/cpp_int.hpp>
namespace mp=boost::multiprecision;

template<typename type>
class field{
public:
    function<type(type,type)> add=[](double A,double B){
        return (A+B);
    };
    function<type(type,type)> product=[](double A,double B){
        return (A*B);
    };
    function<bool(type)> in=[this](type a){
        int comp;
        return true;
    };//引数が体の要素か否か
    function<type(type)> add_inverse=[this](type a){
        return -a;
    };
    function<type(type)> product_inverse=[this](type a){
        return 1.0/a;
    };
    type power(type a,mp::cpp_int p){
        type temp=a;
        type ans=one;
        while(p>0){
            if(p%2){
                ans=product(ans,temp);
            }
            p/=2;
            temp=product(temp,temp);
        }
        return ans;
    }
    double one=1.0,zero=0;
    field(string s="real",int param=1000000007){
        if(s=="residue"){
            int MOD=param;
            add=[MOD](int a,int b){
                long long A=a,B=b;
                return (A+B)%MOD;
            };
            product=[MOD](int a,int b){
                long long A=a,B=b;
                return (A*B)%MOD;
            };
            in=[MOD](type a){
                int comp;
                return typeid(comp)==typeid(a) && 0<=a && a<MOD;
            };//引数が体の要素か否か
            add_inverse=[MOD](int a){
                return (-a+MOD)%MOD;
            };
            product_inverse=[MOD](int a){
                long long temp=a;
                long long ans=1;
                int p=MOD-2;
                while(p>0){
                    if(p%2){
                        ans=(ans*temp)%MOD;
                    }
                    temp=(temp*temp)%MOD;
                    p/=2;
                }
                int l=ans;
                return l;
            };
            one=1,zero=0;
        }else if(s=="real"){
        }
    }
};


int main(){
    mp::cpp_int N,M,X;
    cin>>N>>M>>X;
    mp::cpp_int a=0;
    mp::cpp_int input;
    for(int i=0;i<N+M;i++){
        cin>>input;
        a^=input;
    }
    if(a){
        cout<<0<<endl;
        return 0;
    }
    field<int> f("residue");
    int ans=2;
    ans=f.power(ans,N-1);
    ans=f.power(ans,M-1);
    ans=f.power(ans,X);
    cout<<ans<<endl;
}

0