結果

問題 No.967 引き算をして門松列(その2)
コンテスト
ユーザー 👑 tails
提出日時 2021-03-12 23:46:23
言語 C(gnu17)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=gnu17 -Wno-error=implicit-function-declaration -Wno-error=implicit-int -Wno-error=incompatible-pointer-types -Wno-error=int-conversion -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,093 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 85 ms
コンパイル使用メモリ 28,796 KB
最終ジャッジ日時 2026-02-22 06:57:30
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
main.c: In function 'f':
main.c:12:6: warning: old-style function definition [-Wold-style-definition]
   12 | long f(a,b,c,x,y){
      |      ^
main.c:12:6: error: type of 'a' defaults to 'int' [-Wimplicit-int]
main.c:12:6: error: type of 'b' defaults to 'int' [-Wimplicit-int]
main.c:12:6: error: type of 'c' defaults to 'int' [-Wimplicit-int]
main.c:12:6: error: type of 'x' defaults to 'int' [-Wimplicit-int]
main.c:12:6: error: type of 'y' defaults to 'int' [-Wimplicit-int]
main.c: At top level:
main.c:28:1: error: return type defaults to 'int' [-Wimplicit-int]
   28 | main(){
      | ^~~~
main.c: In function 'main':
main.c:29:17: error: too many arguments to function 'mmap'; expected 0, have 6
   29 |         char*rp=mmap(0l,1l<<28,1,2,0,0ll);
      |                 ^~~~ ~~
main.c:4:6: note: declared here
    4 | char*mmap();
      |      ^~~~
main.c:51:9: error: implicit declaration of function 'write' [-Wimplicit-function-declaration]
   51 |         write(1,wbuf,wp-wbuf);
      |         ^~~~~
main.c:52:9: error: implicit declaration of function '_exit' [-Wimplicit-function-declaration]
   52 |         _exit(0);
      |         ^~~~~
main.c:52:9: warning: incompatible implicit declaration of built-in function '_exit' [-Wbuiltin-declaration-mismatch]

ソースコード

diff #
raw source code

#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<<28];
#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){if(v>=10000000000000000l){WTHI(v/10000000000000000l);WTLO(v/100000000);}else WTHI(v/100000000);WTLO(v);}else{WTHI(v);}

long f(a,b,c,x,y){
	long res = 0;
	if(b >= c){
		res += 1l * y * (b-c+1);
		b = c-1;
	}
	if(a >= b){
		res += 1l * x * (a-b+1);
		a = b-1;
	}
	if(a <= 0){
		res = 1l<<62;
	}
	return res;
}

main(){
	char*rp=mmap(0l,1l<<28,1,2,0,0ll);
	char*wp=wbuf;
	while(*rp++>=48);
	do{
		RD(a);RD(b);RD(c);
		RD(x);RD(y);RD(z);
		long z0,z1;
		z0=f(b,c,a,y,z);
		z1=f(c,a,b,z,x);
		z0=z0<=z1?z0:z1;
		z1=f(b,a,c,y,x);
		z0=z0<=z1?z0:z1;
		z1=f(a,c,b,x,z);
		z0=z0<=z1?z0:z1;
		if(z0>>62){
			*wp++=45;
			*wp++=49;
		}else{
			WT(z0);
		}
		*wp++=10;
	}while(*rp);
	write(1,wbuf,wp-wbuf);
	_exit(0);
}
0