結果

問題 No.1566 All Even
ユーザー tailstails
提出日時 2021-06-27 00:54:50
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 1,565 bytes
コンパイル時間 185 ms
コンパイル使用メモリ 31,340 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-07 17:06:32
合計ジャッジ時間 1,387 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 0 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 0 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 0 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 0 ms
4,380 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 0 ms
4,376 KB
testcase_13 AC 0 ms
4,376 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 0 ms
4,376 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 0 ms
4,380 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 1 ms
4,380 KB
testcase_23 AC 0 ms
4,376 KB
testcase_24 AC 0 ms
4,376 KB
testcase_25 AC 1 ms
4,376 KB
testcase_26 AC 0 ms
4,376 KB
testcase_27 AC 0 ms
4,376 KB
testcase_28 AC 1 ms
4,380 KB
testcase_29 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:78:1: 警告: 戻り値の型をデフォルトの ‘int’ にします [-Wimplicit-int]
   78 | main(){
      | ^~~~
main.c: 関数 ‘main’ 内:
main.c:102:17: 警告: 関数 ‘write’ の暗黙的な宣言です [-Wimplicit-function-declaration]
  102 |                 write(1,wp,wbuf+sizeof wbuf-wp);
      |                 ^~~~~
main.c:111:33: 警告: implicit declaration of function ‘_exit’; did you mean ‘_Exit’? [-Wimplicit-function-declaration]
  111 |                                 _exit(0);
      |                                 ^~~~~
      |                                 _Exit

ソースコード

diff #

#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")

char*mmap();
#define rd_skip() while(*rp++>=48)
#define rd(v) int v=0;{int _c;while(_c=*rp++-48,_c>=0)v=v*10+_c;}
#define wt(v) {long _z=v;do*--wp=_z%10+48;while(_z/=10);}

long pat[][16]={
	{
	},
	{
		0,
		1,
	},
	{
		0x0000,
		0x0003,
		0x0101,
		0x0102,
		0x0201,
		0x0202,
		0x0300,
		0x0303,
	},
	{
		0x000007,
		0x000700,
		0x010101,
		0x010606,
		0x020202,
		0x020505,
		0x030304,
		0x030403,
		0x040303,
		0x040404,
		0x050205,
		0x050502,
		0x060106,
		0x060601,
		0x070000,
		0x070707,
	},
	{
		0x00000f00,
		0x000f0000,
		0x02020202,
		0x020d0d02,
		0x04040404,
		0x040b0b04,
		0x06060906,
		0x06090606,
		0x09060609,
		0x09090909,
		0x0b040b0b,
		0x0b0b040b,
		0x0d020d0d,
		0x0d0d020d,
		0x0f00000f,
		0x0f0f0f0f,
	},
	{
		0x00001f0000,
		0x0404040404,
		0x0916160916,
		0x0d120d0d12,
		0x120d0d120d,
		0x1609161609,
		0x1b1b041b1b,
		0x1f1f1f1f1f,
	},
	{
		0x3f3f3f3f3f3f,
		0x2d122d2d122d
	},
};

main(){
	char*rp=mmap(0l,1l<<25,1,2,0,0ll);
	rd(n);
	rd(m);
	if(n<7){
		int pn="\x00\x02\x08\x10\x10\x08\x02"[n];
		int pb=0;
		while(*rp){
			rd(x);
			rd(y);
			int z=*rp&1;
			rp+=2;
			x=x-1|y-1<<8;
			int pi=1;
			for(int i=0;i<pn;++i){
				if(pat[n][i]>>x&1^z){
					pb|=pi;
				}
				pi<<=1;
			}
		}
		int res=pn-__builtin_popcount(pb);
		char wbuf[64],*wp=wbuf+sizeof wbuf;
		wt(res);
		write(1,wp,wbuf+sizeof wbuf-wp);
	}else{
		while(*rp){
			rd_skip();
			rd_skip();
			int z=*rp;
			rp+=2;
			if(z=='0'){
				write(1,"0",1);
				_exit(0);
			}
		}
		write(1,"1",1);
	}
	_exit(0);
}
0