結果
| 問題 |
No.1566 All Even
|
| コンテスト | |
| ユーザー |
chocorusk
|
| 提出日時 | 2021-08-11 12:28:48 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,878 bytes |
| コンパイル時間 | 3,793 ms |
| コンパイル使用メモリ | 181,176 KB |
| 最終ジャッジ日時 | 2025-01-23 17:33:49 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 24 WA * 4 |
ソースコード
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#include <list>
#include <atcoder/all>
#define popcount __builtin_popcount
using namespace std;
using namespace atcoder;
typedef long long ll;
typedef pair<int, int> P;
int main()
{
using mint=modint998244353;
int n, m; cin>>n>>m;
int x[101], y[101], z[101];
for(int i=0; i<m; i++){
cin>>x[i]>>y[i]>>z[i];
x[i]--; y[i]--;
}
int n1=n;
if(n>=6){
if(n&1) n1=7;
else n1=6;
}
mint ans=0;
for(int i=0; i<(1<<n1); i+=2){
for(int j=0; j<(1<<n1); j++){
bool dame=0;
if(n1>=6){
for(int x1=2; x1<n1-2; x1++){
for(int y1=2; y1<n1-2; y1++){
int t=((i>>x1)&1)^((j>>y1)&1);
if(t!=1){
dame=1;
}
}
}
if(dame) continue;
}
for(int k=0; k<m; k++){
int x1=x[k], y1=y[k];
if(n1>=6){
if(2<=x1 && x1<n-2) x1=2;
else if(x1>=n-2) x1=n1-(n-x1);
if(2<=y1 && y1<n-2) y1=2;
else if(y1>=n-2) y1=n1-(n-y1);
}
int t=((i>>x1)&1)^((j>>y1)&1);
if(t!=z[k]){
dame=1; break;
}
}
if(dame) continue;
for(int x0=0; x0<n1; x0++){
for(int y0=0; y0<n1; y0++){
for(int k=3; x0+k<=n1 && y0+k<=n1; k+=2){
int s=0;
for(int x1=x0; x1<x0+k; x1++){
for(int y1=y0; y1<y0+k; y1++){
int t=((i>>x1)&1)^((j>>y1)&1);
s^=t;
}
}
if(s!=1){
dame=1; break;
}
}
if(dame) break;
}
if(dame) break;
}
if(dame) continue;
ans++;
}
}
cout<<ans.val()<<endl;
return 0;
}
chocorusk