結果

問題 No.1566 All Even
ユーザー chocoruskchocorusk
提出日時 2021-08-11 12:36:37
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 28 ms / 2,000 ms
コード長 1,879 bytes
コンパイル時間 4,459 ms
コンパイル使用メモリ 189,820 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-25 03:38:14
合計ジャッジ時間 4,807 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 27 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 27 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 6 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 6 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 7 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 6 ms
4,348 KB
testcase_12 AC 27 ms
4,348 KB
testcase_13 AC 27 ms
4,348 KB
testcase_14 AC 6 ms
4,348 KB
testcase_15 AC 6 ms
4,348 KB
testcase_16 AC 28 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 2 ms
4,348 KB
testcase_26 AC 2 ms
4,348 KB
testcase_27 AC 2 ms
4,348 KB
testcase_28 AC 6 ms
4,348 KB
testcase_29 AC 27 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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>=9){
		if(n&1) n1=9;
		else n1=10;
	}
	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>=9){
				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>=9){
					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;
}
0