結果

問題 No.2112 All 2x2 are Equal
ユーザー tailstails
提出日時 2022-10-28 23:11:18
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 15 ms / 2,000 ms
コード長 585 bytes
コンパイル時間 868 ms
コンパイル使用メモリ 25,824 KB
実行使用メモリ 9,736 KB
最終ジャッジ日時 2023-09-20 06:25:16
合計ジャッジ時間 5,695 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 0 ms
4,376 KB
testcase_02 AC 1 ms
4,384 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 6 ms
5,508 KB
testcase_05 AC 8 ms
5,576 KB
testcase_06 AC 14 ms
9,736 KB
testcase_07 AC 4 ms
4,380 KB
testcase_08 AC 11 ms
7,676 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 6 ms
5,556 KB
testcase_11 AC 4 ms
4,376 KB
testcase_12 AC 4 ms
4,380 KB
testcase_13 AC 12 ms
7,652 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 9 ms
5,584 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 11 ms
7,584 KB
testcase_18 AC 2 ms
4,384 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 10 ms
7,552 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 1 ms
4,380 KB
testcase_24 AC 2 ms
4,384 KB
testcase_25 AC 3 ms
4,376 KB
testcase_26 AC 2 ms
4,380 KB
testcase_27 AC 3 ms
4,380 KB
testcase_28 AC 7 ms
5,540 KB
testcase_29 AC 2 ms
4,380 KB
testcase_30 AC 5 ms
4,380 KB
testcase_31 AC 9 ms
5,588 KB
testcase_32 AC 15 ms
9,628 KB
testcase_33 AC 15 ms
9,672 KB
testcase_34 AC 15 ms
9,668 KB
testcase_35 AC 15 ms
9,688 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:14:3: warning: implicit declaration of function ‘read’; did you mean ‘rd’? [-Wimplicit-function-declaration]
   read(0,rbuf,sizeof rbuf);
   ^~~~
   rd
main.c:31:17: warning: multi-character character constant [-Wmultichar]
  *(unsigned*)wp='\nseY';
                 ^~~~~~~
main.c:32:2: warning: implicit declaration of function ‘write’ [-Wimplicit-function-declaration]
  write(1,wp,wbuf+sizeof wbuf-wp);
  ^~~~~
main.c:33:2: warning: implicit declaration of function ‘_exit’ [-Wimplicit-function-declaration]
  _exit(0);
  ^~~~~
main.c:33:2: warning: incompatible implicit declaration of built-in function ‘_exit’

ソースコード

diff #

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

#define rd() ({int _v=0,_c;while(_c=*rp++-48,_c>=0)_v=_v*10+_c;_v;})
#define wt(v) {unsigned _z=v;do*--wp=_z%10+48;while(_z/=10);}
#define rep(v,e) for(long v=0;v<e;++v)

char wbuf[1<<25];

int main(){
	long h,w;
	{
		char rbuf[64];
		read(0,rbuf,sizeof rbuf);
		char*rp=rbuf;
		h=rd();
		w=rd();
	}
	char*wp=wbuf+sizeof wbuf;
	unsigned a=h*w;
	unsigned b=0;
	rep(y,h){
		*--wp='\n';
		rep(x,w){
			wt(y+x&1?a--:++b);
			*--wp=' ';
		}
		++wp;
	}
	wp-=4;
	*(unsigned*)wp='\nseY';
	write(1,wp,wbuf+sizeof wbuf-wp);
	_exit(0);
}
0