結果
問題 | No.1210 XOR Grid |
ユーザー |
![]() |
提出日時 | 2021-05-13 03:07:04 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,362 bytes |
コンパイル時間 | 6,087 ms |
コンパイル使用メモリ | 349,192 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-24 16:25:49 |
合計ジャッジ時間 | 11,220 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 39 WA * 18 |
ソースコード
#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,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(){ int N,M,X; cin>>N>>M>>X; int a=0; 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; }