結果

問題 No.325 マンハッタン距離2
ユーザー tailstails
提出日時 2015-12-18 00:37:08
言語 C90
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 339 bytes
コンパイル時間 190 ms
コンパイル使用メモリ 20,608 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-16 08:13:32
合計ジャッジ時間 1,137 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 1 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 0 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 0 ms
5,376 KB
testcase_15 AC 0 ms
5,376 KB
testcase_16 AC 0 ms
5,376 KB
testcase_17 AC 1 ms
5,376 KB
testcase_18 AC 1 ms
5,376 KB
testcase_19 AC 1 ms
5,376 KB
testcase_20 AC 1 ms
5,376 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 0 ms
5,376 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:1:1: warning: data definition has no type or storage class
    1 | s;
      | ^
main.c:1:1: warning: type defaults to ‘int’ in declaration of ‘s’ [-Wimplicit-int]
main.c:2:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
    2 | g(x){return x>0?x*(1+x)/2:0;}
      | ^
main.c: In function ‘g’:
main.c:2:1: warning: type of ‘x’ defaults to ‘int’ [-Wimplicit-int]
main.c: At top level:
main.c:3:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
    3 | f(u,v,x,y,d,t){
      | ^
main.c: In function ‘f’:
main.c:3:1: warning: type of ‘u’ defaults to ‘int’ [-Wimplicit-int]
main.c:3:1: warning: type of ‘v’ defaults to ‘int’ [-Wimplicit-int]
main.c:3:1: warning: type of ‘x’ defaults to ‘int’ [-Wimplicit-int]
main.c:3:1: warning: type of ‘y’ defaults to ‘int’ [-Wimplicit-int]
main.c:3:1: warning: type of ‘d’ defaults to ‘int’ [-Wimplicit-int]
main.c:3:1: warning: type of ‘t’ defaults to ‘int’ [-Wimplicit-int]
main.c: At top level:
main.c:12:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
   12 | main(u,v,x,y,d){
      | ^~~~
main.c: In function ‘main’:
main.c:12:1: warning: type of ‘u’ defaults to ‘int’ [-Wimplicit-int]
main.c:12:1: warning: type of ‘v’ defaults to ‘int’ [-Wimplicit-int]
main.c:12:1: warning: type of ‘x’ defaults to ‘int’ [-Wimplicit-int]
main.c:12:1: warning: type of ‘y’ defaults to ‘int’ [-Wimplicit-int]
main.c:12:1: warning: type of ‘d’ defaults to ‘int’ [-Wimplicit-int]
main.c:13:9: warning: implicit declaration of function ‘scanf’ [-Wimplicit-function-declaration]
   13 |         scanf("%d%d%d%d%d",&u,&v,&x,&y,&d);
      |         ^~~~~
main.c:1:1: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
  +++ |+#include <stdio.h>
    1 | s;
main.c:13:9: warning: incompatible implicit declaration of built-in function ‘scanf’ [-Wbuiltin-declaration-mismatch]
   13 |         s

ソースコード

diff #

s;
g(x){return x>0?x*(1+x)/2:0;}
f(u,v,x,y,d,t){
	if(u>x)t=u,u=x,x=t;
	if(v>y)t=v,v=y,y=t;
	if((x|y|d)>=0){
		if(u>0)x-=u,d-=u;
		if(v>0)y-=v,d-=v;
		s+=d>x+y?~x*~y:g(d+1)-g(d-x)-g(d-y);
	}
}
main(u,v,x,y,d){
	scanf("%d%d%d%d%d",&u,&v,&x,&y,&d);
	f(u,v,x,y,d);
	f(~u,v,~x,y,--d);
	f(u,~v,x,~y,d);
	f(~u,~v,~x,~y,--d);
	s=!printf("%d",s);
}
0