結果

問題 No.967 引き算をして門松列(その2)
ユーザー tailstails
提出日時 2021-03-12 23:46:23
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,093 bytes
コンパイル時間 489 ms
コンパイル使用メモリ 34,304 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-22 15:08:35
合計ジャッジ時間 1,567 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 0 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function 'f':
main.c:12:6: warning: type of 'a' defaults to 'int' [-Wimplicit-int]
   12 | long f(a,b,c,x,y){
      |      ^
main.c:12:6: warning: type of 'b' defaults to 'int' [-Wimplicit-int]
main.c:12:6: warning: type of 'c' defaults to 'int' [-Wimplicit-int]
main.c:12:6: warning: type of 'x' defaults to 'int' [-Wimplicit-int]
main.c:12:6: warning: type of 'y' defaults to 'int' [-Wimplicit-int]
main.c: At top level:
main.c:28:1: warning: return type defaults to 'int' [-Wimplicit-int]
   28 | main(){
      | ^~~~
main.c: In function 'main':
main.c:51:9: warning: implicit declaration of function 'write' [-Wimplicit-function-declaration]
   51 |         write(1,wbuf,wp-wbuf);
      |         ^~~~~
main.c:52:9: warning: implicit declaration of function '_exit'; did you mean '_Exit'? [-Wimplicit-function-declaration]
   52 |         _exit(0);
      |         ^~~~~
      |         _Exit

ソースコード

diff #

#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