結果

問題 No.2393 Bit Grid Connected Component
ユーザー tailstails
提出日時 2023-07-31 15:14:23
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 6 ms / 2,000 ms
コード長 1,625 bytes
コンパイル時間 969 ms
コンパイル使用メモリ 22,784 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-10 08:30:35
合計ジャッジ時間 2,075 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,816 KB
testcase_01 AC 1 ms
6,820 KB
testcase_02 AC 1 ms
6,820 KB
testcase_03 AC 1 ms
6,820 KB
testcase_04 AC 0 ms
6,816 KB
testcase_05 AC 0 ms
6,816 KB
testcase_06 AC 0 ms
6,816 KB
testcase_07 AC 0 ms
6,816 KB
testcase_08 AC 1 ms
6,816 KB
testcase_09 AC 1 ms
6,816 KB
testcase_10 AC 0 ms
6,820 KB
testcase_11 AC 0 ms
6,820 KB
testcase_12 AC 1 ms
6,816 KB
testcase_13 AC 0 ms
6,820 KB
testcase_14 AC 0 ms
6,820 KB
testcase_15 AC 1 ms
6,824 KB
testcase_16 AC 2 ms
6,820 KB
testcase_17 AC 6 ms
6,816 KB
testcase_18 AC 6 ms
6,816 KB
testcase_19 AC 5 ms
6,820 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:85:24: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
   85 |                 char*p=r[y+__builtin_ctzl(~(x>>y))];
      |                        ^
main.c:90:9: warning: implicit declaration of function ‘write’ [-Wimplicit-function-declaration]
   90 |         write(1,wbuf,wp-wbuf);
      |         ^~~~~
main.c:91:9: warning: implicit declaration of function ‘_exit’ [-Wimplicit-function-declaration]
   91 |         _exit(0);
      |         ^~~~~
main.c:91: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_skip() while(*rp++>=48)
#define rd() ({long _v=0,_c;while(_c=*rp++-48,_c>=0)_v=_v*10+_c;_v;})

char const r[][32]={
	"0\n",
	"1\n",
	"3\n",
	"7\n",
	"15\n",
	"31\n",
	"63\n",
	"127\n",
	"255\n",
	"511\n",
	"1023\n",
	"2047\n",
	"4095\n",
	"8191\n",
	"16383\n",
	"32767\n",
	"65535\n",
	"131071\n",
	"262143\n",
	"524287\n",
	"1048575\n",
	"2097151\n",
	"4194303\n",
	"8388607\n",
	"16777215\n",
	"33554431\n",
	"67108863\n",
	"134217727\n",
	"268435455\n",
	"536870911\n",
	"1073741823\n",
	"2147483647\n",
	"4294967295\n",
	"8589934591\n",
	"17179869183\n",
	"34359738367\n",
	"68719476735\n",
	"137438953471\n",
	"274877906943\n",
	"549755813887\n",
	"1099511627775\n",
	"2199023255551\n",
	"4398046511103\n",
	"8796093022207\n",
	"17592186044415\n",
	"35184372088831\n",
	"70368744177663\n",
	"140737488355327\n",
	"281474976710655\n",
	"562949953421311\n",
	"1125899906842623\n",
	"2251799813685247\n",
	"4503599627370495\n",
	"9007199254740991\n",
	"18014398509481983\n",
	"36028797018963967\n",
	"72057594037927935\n",
	"144115188075855871\n",
	"288230376151711743\n",
	"576460752303423487\n",
	"1152921504606846975\n",
	"2305843009213693951\n",
	"4611686018427387903\n",
	"9223372036854775807\n",
	"18446744073709551615\n",
};

typedef unsigned long ulong;
char wbuf[1<<25];

int main(){
	rd_init();
	rd_skip();
	char*wp=wbuf;
	while(*rp){
		ulong x=rd(),y=rd();
		char*p=r[y+__builtin_ctzl(~(x>>y))];
		for(int c;c=*p++;){
			*wp++=c;
		}
	}
	write(1,wbuf,wp-wbuf);
	_exit(0);
}
0