結果
| 問題 |
No.1056 2D Lamps
|
| コンテスト | |
| ユーザー |
beet
|
| 提出日時 | 2020-05-15 22:35:20 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,606 bytes |
| コンパイル時間 | 8,598 ms |
| コンパイル使用メモリ | 382,784 KB |
| 最終ジャッジ日時 | 2025-01-10 11:50:30 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 7 WA * 7 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
using Int = long long;
const char newl = '\n';
//INSERT ABOVE HERE
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
using ull = mp::int1024_t;
ull rnd[300][300];
vector<ull> vs;
void add(ull v){
for(ull b:vs) chmin(v,v^b);
if(v!=0) vs.emplace_back(v);
}
void init(int n){
mt19937_64 mt(1333);
for(int i=0;i<n;i++)
for(int j=0;j<n;j++)
rnd[i][j]=(ull(mt())<<64)|mt();
for(int i=0;i<n;i++){
ull res=0;
for(int j=0;j<n;j++)
res^=rnd[i][j];
add(res);
}
for(int j=0;j<n;j++){
ull res=0;
for(int i=0;i<n;i++)
res^=rnd[i][j];
add(res);
}
for(int k=0;k<n*2;k++){
ull res=0;
for(int i=0;i<n;i++)
for(int j=0;j<n;j++)
if(i+j==k) res^=rnd[i][j];
add(res);
}
for(int k=-n;k<n;k++){
ull res=0;
for(int i=0;i<n;i++)
for(int j=0;j<n;j++)
if(i-j==k) res^=rnd[i][j];
add(res);
}
}
ull input(int n){
ull res=0;
for(int i=0;i<n;i++){
string s;
cin>>s;
for(int j=0;j<n;j++)
if(s[j]=='.') res^=rnd[i][j];
}
for(ull b:vs) chmax(res,res^b);
return res;
}
signed main(){
cin.tie(0);
ios::sync_with_stdio(0);
int n,m;
cin>>n>>m;
init(n);
vector<ull> vs;
for(int i=0;i<m;i++) vs.emplace_back(input(n));
for(int i=0;i+1<m;i++){
for(int j=i+1;j<m;j++)
cout<<(vs[i]==vs[j]);
cout<<newl;
}
return 0;
}
beet