結果
問題 | No.966 引き算をして門松列(その1) |
ユーザー |
![]() |
提出日時 | 2021-02-04 10:54:55 |
言語 | C (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 874 bytes |
コンパイル時間 | 233 ms |
コンパイル使用メモリ | 32,000 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-30 16:04:43 |
合計ジャッジ時間 | 651 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 5 |
コンパイルメッセージ
main.c:12:15: warning: return type defaults to 'int' [-Wimplicit-int] 12 | static inline max0(int x){ | ^~~~ main.c:18:1: warning: return type defaults to 'int' [-Wimplicit-int] 18 | main(){ | ^~~~ main.c: In function 'main': main.c:40:9: warning: implicit declaration of function 'write' [-Wimplicit-function-declaration] 40 | write(1,wbuf,wp-wbuf); | ^~~~~ main.c:41:9: warning: implicit declaration of function '_exit'; did you mean '_Exit'? [-Wimplicit-function-declaration] 41 | _exit(0); | ^~~~~ | _Exit
ソースコード
#pragma GCC optimize("Ofast")#pragma GCC target("avx2")char*mmap();#define RD(v) int v=0;{int _c;while(_c=*rp++-48,_c>=0)v=v*10+_c;}char wbuf[1<<20];#define WTHI(v) {long _z=v,_n=0,_d=0;while(++_n,_d=_d<<8|0x30|_z%10,_z/=10);*(long*)wp=_d;wp+=_n;}#define WTLO(v) {long _z=v,_n=8,_d=0;while(_d=_d<<8|0x30|_z%10,_z/=10,--_n);*(long*)wp=_d;wp+=8;}#define WT(v) if(v>=100000000){WTHI(v/100000000);WTLO(v);}else{WTHI(v);}static inline max0(int x){return x>=0?x:0;}#define INF 0x70000000main(){char*rp=mmap(0l,1l<<28,1,2,0,0ll);char*wp=wbuf;while(*rp++>=48);do{RD(a);RD(b);RD(c);int x,y,z;if(a>c){int t=a;a=c;c=t;}a-=x=a==c;y=b>2?max0(c-(b-1))+max0(a-(b-2)):INF;z=a>1?max0(b-(a-1)):INF;x+=y<z?y:z;if(!a|x>=INF){*wp++=45;*wp++=49;}else{WT(x);}*wp++=10;}while(*rp);write(1,wbuf,wp-wbuf);_exit(0);}