結果
| 問題 |
No.2746 Bicolor Pyramid
|
| コンテスト | |
| ユーザー |
tails
|
| 提出日時 | 2024-04-21 23:28:05 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| コード長 | 18,136 bytes |
| コンパイル時間 | 400 ms |
| コンパイル使用メモリ | 23,552 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-13 21:56:08 |
| 合計ジャッジ時間 | 1,826 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 36 |
コンパイルメッセージ
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]
ソースコード
#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);
}
tails