結果

問題 No.2746 Bicolor Pyramid
ユーザー tailstails
提出日時 2024-04-21 23:28:05
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 18,136 bytes
コンパイル時間 588 ms
コンパイル使用メモリ 23,424 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-21 23:28:07
合計ジャッジ時間 1,409 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 0 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 0 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 0 ms
5,376 KB
testcase_07 AC 0 ms
5,376 KB
testcase_08 AC 0 ms
5,376 KB
testcase_09 AC 0 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 0 ms
5,376 KB
testcase_12 AC 0 ms
5,376 KB
testcase_13 AC 0 ms
5,376 KB
testcase_14 AC 1 ms
5,376 KB
testcase_15 AC 0 ms
5,376 KB
testcase_16 AC 1 ms
5,376 KB
testcase_17 AC 0 ms
5,376 KB
testcase_18 AC 1 ms
5,376 KB
testcase_19 AC 1 ms
5,376 KB
testcase_20 AC 0 ms
5,376 KB
testcase_21 AC 1 ms
5,376 KB
testcase_22 AC 1 ms
5,376 KB
testcase_23 AC 0 ms
5,376 KB
testcase_24 AC 1 ms
5,376 KB
testcase_25 AC 1 ms
5,376 KB
testcase_26 AC 0 ms
5,376 KB
testcase_27 AC 1 ms
5,376 KB
testcase_28 AC 1 ms
5,376 KB
testcase_29 AC 0 ms
5,376 KB
testcase_30 AC 1 ms
5,376 KB
testcase_31 AC 1 ms
5,376 KB
testcase_32 AC 1 ms
5,376 KB
testcase_33 AC 0 ms
5,376 KB
testcase_34 AC 1 ms
5,376 KB
testcase_35 AC 1 ms
5,376 KB
testcase_36 AC 0 ms
5,376 KB
testcase_37 AC 1 ms
5,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:144:7: warning: type defaults to ‘int’ in declaration of ‘t’ [-Wimplicit-int]
  144 | const t[]={0,1,1,1,4,5,5,5,5,9,10,10,10,13,14,14,16,17,17,17,20,21,21,21,21,25,26,26,26,29,30,30,30,30,34,35,36,37,38,39,40,41,42,42,42,45,46,46,46,49,50,51,52,53,54,55,56,57,58,59,59,61,62,63,64,65,66,66,68,69,70,71,71,73,74,75,75,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,91,93,94,95,95,97,98,99,100,101,102,103,104,105,106,107,107,109,110,111,111,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,127,};
      |       ^
main.c: In function ‘main’:
main.c:154:17: warning: implicit declaration of function ‘write’ [-Wimplicit-function-declaration]
  154 |                 write(1,s[r-1]+(b-1),1);
      |                 ^~~~~
main.c:172:9: warning: implicit declaration of function ‘_exit’ [-Wimplicit-function-declaration]
  172 |         _exit(0);
      |         ^~~~~
main.c:172: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_skip_line() while(*rp++!=10)
#define rd() ({long _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 wt1(v) ({char wbuf[64],*wp=wbuf+sizeof wbuf;wt(v);write(1,wp,wbuf+sizeof wbuf-wp);})

typedef unsigned long ulong;

const char s[][128]={
"11122222222233333333333333334444444444444444444444444555555555555555555555555555555555555666666666666666666666666666666666666666",
"11122222222233333333333333334444444444444444444444444555555555555555555555555555555555555666666666666666666666666666666666666666",
"11122222222233333333333333334444444444444444444444444555555555555555555555555555555555555666666666666666666666666666666666666666",
"22222222233333333333333334444444444444444444444444555555555555555555555555555555555555666666666666666666666666666666666666666666",
"22222222333333333333333344444444444444444444444445555555555555555555555555555555555556666666666666666666666666666666666666666666",
"22222222333333333333333344444444444444444444444445555555555555555555555555555555555556666666666666666666666666666666666666666666",
"22222222333333333333333344444444444444444444444445555555555555555555555555555555555556666666666666666666666666666666666666666666",
"22222222333333333333333344444444444444444444444445555555555555555555555555555555555556666666666666666666666666666666666666666666",
"22223333333333333333444444444444444444444444455555555555555555555555555555555555566666666666666666666666666666666666666666666666",
"22233333333333333334444444444444444444444444555555555555555555555555555555555555666666666666666666666666666666666666666666666666",
"22233333333333333334444444444444444444444444555555555555555555555555555555555555666666666666666666666666666666666666666666666666",
"22233333333333333334444444444444444444444444555555555555555555555555555555555555666666666666666666666666666666666666666666666666",
"33333333333333334444444444444444444444444555555555555555555555555555555555555666666666666666666666666666666666666666666666666677",
"33333333333333344444444444444444444444445555555555555555555555555555555555556666666666666666666666666666666666666666666666666777",
"33333333333333344444444444444444444444445555555555555555555555555555555555556666666666666666666666666666666666666666666666666777",
"33333333333334444444444444444444444444555555555555555555555555555555555555666666666666666666666666666666666666666666666666677777",
"33333333333344444444444444444444444445555555555555555555555555555555555556666666666666666666666666666666666666666666666666777777",
"33333333333344444444444444444444444445555555555555555555555555555555555556666666666666666666666666666666666666666666666666777777",
"33333333333344444444444444444444444445555555555555555555555555555555555556666666666666666666666666666666666666666666666666777777",
"33333333344444444444444444444444445555555555555555555555555555555555556666666666666666666666666666666666666666666666666777777777",
"33333333444444444444444444444444455555555555555555555555555555555555566666666666666666666666666666666666666666666666667777777777",
"33333333444444444444444444444444455555555555555555555555555555555555566666666666666666666666666666666666666666666666667777777777",
"33333333444444444444444444444444455555555555555555555555555555555555566666666666666666666666666666666666666666666666667777777777",
"33333333444444444444444444444444455555555555555555555555555555555555566666666666666666666666666666666666666666666666667777777777",
"33334444444444444444444444444555555555555555555555555555555555555666666666666666666666666666666666666666666666666677777777777777",
"33344444444444444444444444445555555555555555555555555555555555556666666666666666666666666666666666666666666666666777777777777777",
"33344444444444444444444444445555555555555555555555555555555555556666666666666666666666666666666666666666666666666777777777777777",
"33344444444444444444444444445555555555555555555555555555555555556666666666666666666666666666666666666666666666666777777777777777",
"44444444444444444444444445555555555555555555555555555555555556666666666666666666666666666666666666666666666666777777777777777777",
"44444444444444444444444455555555555555555555555555555555555566666666666666666666666666666666666666666666666667777777777777777777",
"44444444444444444444444455555555555555555555555555555555555566666666666666666666666666666666666666666666666667777777777777777777",
"44444444444444444444444455555555555555555555555555555555555566666666666666666666666666666666666666666666666667777777777777777777",
"44444444444444444444444455555555555555555555555555555555555566666666666666666666666666666666666666666666666667777777777777777777",
"44444444444444444444555555555555555555555555555555555555666666666666666666666666666666666666666666666666677777777777777777777777",
"44444444444444444445555555555555555555555555555555555556666666666666666666666666666666666666666666666666777777777777777777777777",
"44444444444444444445555555555555555555555555555555555566666666666666666666666666666666666666666666666667777777777777777777777777",
"44444444444444444445555555555555555555555555555555555666666666666666666666666666666666666666666666666677777777777777777777777777",
"44444444444444445555555555555555555555555555555555556666666666666666666666666666666666666666666666666777777777777777777777777777",
"44444444444444455555555555555555555555555555555555566666666666666666666666666666666666666666666666667777777777777777777777777777",
"44444444444444455555555555555555555555555555555555666666666666666666666666666666666666666666666666677777777777777777777777777777",
"44444444444445555555555555555555555555555555555556666666666666666666666666666666666666666666666666777777777777777777777777777777",
"44444444444455555555555555555555555555555555555566666666666666666666666666666666666666666666666667777777777777777777777777777777",
"44444444444455555555555555555555555555555555555566666666666666666666666666666666666666666666666667777777777777777777777777777777",
"44444444444455555555555555555555555555555555555566666666666666666666666666666666666666666666666667777777777777777777777777777777",
"44444444455555555555555555555555555555555555566666666666666666666666666666666666666666666666667777777777777777777777777777777777",
"44444444555555555555555555555555555555555555666666666666666666666666666666666666666666666666677777777777777777777777777777777777",
"44444444555555555555555555555555555555555555666666666666666666666666666666666666666666666666677777777777777777777777777777777777",
"44444444555555555555555555555555555555555555666666666666666666666666666666666666666666666666677777777777777777777777777777777777",
"44444444555555555555555555555555555555555666666666666666666666666666666666666666666666666677777777777777777777777777777777777777",
"44445555555555555555555555555555555555556666666666666666666666666666666666666666666666666777777777777777777777777777777777777777",
"44455555555555555555555555555555555555566666666666666666666666666666666666666666666666667777777777777777777777777777777777777777",
"44455555555555555555555555555555555555666666666666666666666666666666666666666666666666677777777777777777777777777777777777777777",
"44455555555555555555555555555555555556666666666666666666666666666666666666666666666666777777777777777777777777777777777777777777",
"55555555555555555555555555555555555566666666666666666666666666666666666666666666666667777777777777777777777777777777777777777777",
"55555555555555555555555555555555555666666666666666666666666666666666666666666666666677777777777777777777777777777777777777777777",
"55555555555555555555555555555555556666666666666666666666666666666666666666666666666777777777777777777777777777777777777777777777",
"55555555555555555555555555555555566666666666666666666666666666666666666666666666667777777777777777777777777777777777777777777777",
"55555555555555555555555555555555566666666666666666666666666666666666666666666666677777777777777777777777777777777777777777777777",
"55555555555555555555555555555555566666666666666666666666666666666666666666666666777777777777777777777777777777777777777777777777",
"55555555555555555555555555555555566666666666666666666666666666666666666666666666777777777777777777777777777777777777777777777777",
"55555555555555555555555555555666666666666666666666666666666666666666666666666677777777777777777777777777777777777777777777777777",
"55555555555555555555555555556666666666666666666666666666666666666666666666666777777777777777777777777777777777777777777777777777",
"55555555555555555555555555556666666666666666666666666666666666666666666666667777777777777777777777777777777777777777777777777777",
"55555555555555555555555555556666666666666666666666666666666666666666666666667777777777777777777777777777777777777777777777777777",
"55555555555555555555555556666666666666666666666666666666666666666666666666777777777777777777777777777777777777777777777777777777",
"55555555555555555555555566666666666666666666666666666666666666666666666667777777777777777777777777777777777777777777777777777777",
"55555555555555555555555566666666666666666666666666666666666666666666666667777777777777777777777777777777777777777777777777777777",
"55555555555555555555555566666666666666666666666666666666666666666666666667777777777777777777777777777777777777777777777777777777",
"55555555555555555555555566666666666666666666666666666666666666666666667777777777777777777777777777777777777777777777777777777777",
"55555555555555555555666666666666666666666666666666666666666666666666677777777777777777777777777777777777777777777777777777777777",
"55555555555555555556666666666666666666666666666666666666666666666666777777777777777777777777777777777777777777777777777777777777",
"55555555555555555556666666666666666666666666666666666666666666666666777777777777777777777777777777777777777777777777777777777777",
"55555555555555555556666666666666666666666666666666666666666666666666777777777777777777777777777777777777777777777777777777777777",
"55555555555555556666666666666666666666666666666666666666666666666777777777777777777777777777777777777777777777777777777777777777",
"55555555555555566666666666666666666666666666666666666666666666667777777777777777777777777777777777777777777777777777777777777777",
"55555555555555566666666666666666666666666666666666666666666666667777777777777777777777777777777777777777777777777777777777777777",
"55555555555556666666666666666666666666666666666666666666666666777777777777777777777777777777777777777777777777777777777777777788",
"55555555555566666666666666666666666666666666666666666666666667777777777777777777777777777777777777777777777777777777777777777888",
"55555555555566666666666666666666666666666666666666666666666677777777777777777777777777777777777777777777777777777777777777778888",
"55555555555566666666666666666666666666666666666666666666666677777777777777777777777777777777777777777777777777777777777777788888",
"55555555566666666666666666666666666666666666666666666666667777777777777777777777777777777777777777777777777777777777777777888888",
"55555555666666666666666666666666666666666666666666666666677777777777777777777777777777777777777777777777777777777777777778888888",
"55555555666666666666666666666666666666666666666666666666777777777777777777777777777777777777777777777777777777777777777788888888",
"55555555666666666666666666666666666666666666666666666667777777777777777777777777777777777777777777777777777777777777777888888888",
"55555555666666666666666666666666666666666666666666666677777777777777777777777777777777777777777777777777777777777777778888888888",
"55556666666666666666666666666666666666666666666666666777777777777777777777777777777777777777777777777777777777777777788888888888",
"55566666666666666666666666666666666666666666666666667777777777777777777777777777777777777777777777777777777777777777888888888888",
"55566666666666666666666666666666666666666666666666677777777777777777777777777777777777777777777777777777777777777778888888888888",
"55566666666666666666666666666666666666666666666666777777777777777777777777777777777777777777777777777777777777777788888888888888",
"66666666666666666666666666666666666666666666666667777777777777777777777777777777777777777777777777777777777777777888888888888888",
"66666666666666666666666666666666666666666666666677777777777777777777777777777777777777777777777777777777777777778888888888888888",
"66666666666666666666666666666666666666666666666677777777777777777777777777777777777777777777777777777777777777778888888888888888",
"66666666666666666666666666666666666666666666666677777777777777777777777777777777777777777777777777777777777777888888888888888888",
"66666666666666666666666666666666666666666666677777777777777777777777777777777777777777777777777777777777777778888888888888888888",
"66666666666666666666666666666666666666666666777777777777777777777777777777777777777777777777777777777777777788888888888888888888",
"66666666666666666666666666666666666666666666777777777777777777777777777777777777777777777777777777777777777788888888888888888888",
"66666666666666666666666666666666666666666666777777777777777777777777777777777777777777777777777777777777777788888888888888888888",
"66666666666666666666666666666666666666666777777777777777777777777777777777777777777777777777777777777777788888888888888888888888",
"66666666666666666666666666666666666666667777777777777777777777777777777777777777777777777777777777777777888888888888888888888888",
"66666666666666666666666666666666666666677777777777777777777777777777777777777777777777777777777777777778888888888888888888888888",
"66666666666666666666666666666666666666777777777777777777777777777777777777777777777777777777777777777788888888888888888888888888",
"66666666666666666666666666666666666667777777777777777777777777777777777777777777777777777777777777777888888888888888888888888888",
"66666666666666666666666666666666666677777777777777777777777777777777777777777777777777777777777777778888888888888888888888888888",
"66666666666666666666666666666666666777777777777777777777777777777777777777777777777777777777777777788888888888888888888888888888",
"66666666666666666666666666666666667777777777777777777777777777777777777777777777777777777777777777888888888888888888888888888888",
"66666666666666666666666666666666677777777777777777777777777777777777777777777777777777777777777778888888888888888888888888888888",
"66666666666666666666666666666666677777777777777777777777777777777777777777777777777777777777777778888888888888888888888888888888",
"66666666666666666666666666666666677777777777777777777777777777777777777777777777777777777777777778888888888888888888888888888888",
"66666666666666666666666666666666677777777777777777777777777777777777777777777777777777777777778888888888888888888888888888888888",
"66666666666666666666666666666777777777777777777777777777777777777777777777777777777777777777788888888888888888888888888888888888",
"66666666666666666666666666667777777777777777777777777777777777777777777777777777777777777777888888888888888888888888888888888888",
"66666666666666666666666666667777777777777777777777777777777777777777777777777777777777777777888888888888888888888888888888888888",
"66666666666666666666666666667777777777777777777777777777777777777777777777777777777777777788888888888888888888888888888888888888",
"66666666666666666666666667777777777777777777777777777777777777777777777777777777777777777888888888888888888888888888888888888888",
"66666666666666666666666677777777777777777777777777777777777777777777777777777777777777778888888888888888888888888888888888888888",
"66666666666666666666666677777777777777777777777777777777777777777777777777777777777777788888888888888888888888888888888888888888",
"66666666666666666666666677777777777777777777777777777777777777777777777777777777777777888888888888888888888888888888888888888888",
"66666666666666666666666677777777777777777777777777777777777777777777777777777777777778888888888888888888888888888888888888888888",
"66666666666666666666777777777777777777777777777777777777777777777777777777777777777788888888888888888888888888888888888888888888",
"66666666666666666667777777777777777777777777777777777777777777777777777777777777777888888888888888888888888888888888888888888888",
"66666666666666666667777777777777777777777777777777777777777777777777777777777777778888888888888888888888888888888888888888888888",
"66666666666666666667777777777777777777777777777777777777777777777777777777777777788888888888888888888888888888888888888888888888",
"66666666666666667777777777777777777777777777777777777777777777777777777777777777888888888888888888888888888888888888888888888888",
"66666666666666677777777777777777777777777777777777777777777777777777777777777778888888888888888888888888888888888888888888888888",
"66666666666666677777777777777777777777777777777777777777777777777777777777777788888888888888888888888888888888888888888888888888",
"66666666666667777777777777777777777777777777777777777777777777777777777777777888888888888888888888888888888888888888888888888888",
"66666666666677777777777777777777777777777777777777777777777777777777777777778888888888888888888888888888888888888888888888888888",
"66666666666677777777777777777777777777777777777777777777777777777777777777778888888888888888888888888888888888888888888888888888",
};

const t[]={0,1,1,1,4,5,5,5,5,9,10,10,10,13,14,14,16,17,17,17,20,21,21,21,21,25,26,26,26,29,30,30,30,30,34,35,36,37,38,39,40,41,42,42,42,45,46,46,46,49,50,51,52,53,54,55,56,57,58,59,59,61,62,63,64,65,66,66,68,69,70,71,71,73,74,75,75,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,91,93,94,95,95,97,98,99,100,101,102,103,104,105,106,107,107,109,110,111,111,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,127,};

int main(){
	long r,b;
	{
		rd_init();
		r=rd();
		b=rd();
	}
	if(r<129&&b<129){
		write(1,s[r-1]+(b-1),1);
	}else{
		if(r<129) r=t[r];
		if(b<129) b=t[b];
		r+=b;
		r*=6;
		long f=1;
		long g=1817121;
		while(f+1<g){
			long m=f+g>>1;
			if((ulong)m*(m+1)*(m*2+1)<=r){
				f=m;
			}else{
				g=m;
			}
		}
		wt1(f);
	}
	_exit(0);
}
0