結果

問題 No.2702 Nand Nor Matrix
ユーザー tailstails
提出日時 2024-03-31 16:05:56
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 10 ms / 2,000 ms
コード長 803 bytes
コンパイル時間 265 ms
コンパイル使用メモリ 24,960 KB
実行使用メモリ 8,064 KB
最終ジャッジ日時 2024-03-31 16:06:02
合計ジャッジ時間 5,674 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,676 KB
testcase_01 AC 4 ms
6,676 KB
testcase_02 AC 4 ms
6,676 KB
testcase_03 AC 5 ms
6,676 KB
testcase_04 AC 7 ms
6,676 KB
testcase_05 AC 6 ms
6,676 KB
testcase_06 AC 5 ms
6,676 KB
testcase_07 AC 6 ms
6,676 KB
testcase_08 AC 5 ms
6,676 KB
testcase_09 AC 6 ms
6,676 KB
testcase_10 AC 5 ms
6,676 KB
testcase_11 AC 6 ms
6,676 KB
testcase_12 AC 5 ms
6,676 KB
testcase_13 AC 6 ms
6,676 KB
testcase_14 AC 5 ms
6,676 KB
testcase_15 AC 4 ms
6,676 KB
testcase_16 AC 6 ms
6,676 KB
testcase_17 AC 3 ms
6,676 KB
testcase_18 AC 5 ms
6,676 KB
testcase_19 AC 8 ms
6,784 KB
testcase_20 AC 3 ms
6,676 KB
testcase_21 AC 4 ms
6,676 KB
testcase_22 AC 3 ms
6,676 KB
testcase_23 AC 8 ms
6,676 KB
testcase_24 AC 6 ms
6,676 KB
testcase_25 AC 3 ms
6,676 KB
testcase_26 AC 4 ms
6,676 KB
testcase_27 AC 9 ms
7,552 KB
testcase_28 AC 7 ms
6,676 KB
testcase_29 AC 1 ms
6,676 KB
testcase_30 AC 9 ms
6,676 KB
testcase_31 AC 8 ms
6,676 KB
testcase_32 AC 1 ms
6,676 KB
testcase_33 AC 1 ms
6,676 KB
testcase_34 AC 7 ms
6,676 KB
testcase_35 AC 8 ms
6,676 KB
testcase_36 AC 10 ms
8,064 KB
testcase_37 AC 10 ms
7,168 KB
testcase_38 AC 9 ms
7,168 KB
testcase_39 AC 10 ms
8,064 KB
testcase_40 AC 10 ms
7,168 KB
testcase_41 AC 9 ms
7,296 KB
testcase_42 AC 9 ms
7,296 KB
testcase_43 AC 9 ms
7,040 KB
testcase_44 AC 9 ms
7,424 KB
testcase_45 AC 10 ms
7,424 KB
testcase_46 AC 9 ms
7,424 KB
testcase_47 AC 10 ms
7,296 KB
testcase_48 AC 9 ms
7,040 KB
testcase_49 AC 10 ms
7,424 KB
testcase_50 AC 9 ms
6,676 KB
testcase_51 AC 5 ms
6,676 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:42:9: warning: implicit declaration of function ‘write’ [-Wimplicit-function-declaration]
   42 |         write(1,wbuf,wp-wbuf);
      |         ^~~~~
main.c:43:9: warning: implicit declaration of function ‘_exit’ [-Wimplicit-function-declaration]
   43 |         _exit(0);
      |         ^~~~~
main.c:43:9: warning: incompatible implicit declaration of built-in function ‘_exit’ [-Wbuiltin-declaration-mismatch]

ソースコード

diff #

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

#define rd_init() char*rp=({char*mmap();mmap(0l,1l<<25,1,2,0,0ll);})
#define rd() ({int _v=0,_c;while(_c=*rp++-48,_c>=0)_v=_v*10+_c;_v;})
#define rd_long() ({long _v=0,_c;while(_c=*rp++-48,_c>=0)_v=_v*10+_c;_v;})

char wbuf[1<<25];

int main(){
	rd_init();
	int n=rd();
	char*a=rp;
	char*b=rp+(n-1)*2;
	rp+=(n*2-1)*2;
	int ae=2;
	while(ae<n&&a[ae*2-2]!=a[ae*2])++ae;
	int be=2;
	while(be<n&&b[be*2-2]!=b[be*2])++be;
	if(a[2]!=b[2])be=0;
	char*wp=wbuf;
	for(int q=rd();q--;){
		long t=rd_long();
		int r=rd()-1;
		int c=rd()-1;
		int z;
		if(r==0){
			z=a[c*2];
		}
		else if(c==0){
			z=b[r*2];
		}
		else if(r<be&&c<ae&&t>r+c-2){
			z=a[2]^r+c+1&1;
		}
		else{
			z='0'|t&1;
		}
		*wp++=z;
		*wp++='\n';
	}
	write(1,wbuf,wp-wbuf);
	_exit(0);
}
0