結果
問題 | No.325 マンハッタン距離2 |
ユーザー | tails |
提出日時 | 2015-12-18 00:42:21 |
言語 | C90 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 1 ms / 1,000 ms |
コード長 | 370 bytes |
コンパイル時間 | 207 ms |
コンパイル使用メモリ | 20,736 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-16 08:15:02 |
合計ジャッジ時間 | 1,035 ms |
ジャッジサーバーID (参考情報) |
judge6 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 0 ms
5,248 KB |
testcase_01 | AC | 1 ms
5,376 KB |
testcase_02 | AC | 1 ms
5,376 KB |
testcase_03 | AC | 1 ms
5,376 KB |
testcase_04 | AC | 0 ms
5,376 KB |
testcase_05 | AC | 0 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 | 0 ms
5,376 KB |
testcase_13 | AC | 0 ms
5,376 KB |
testcase_14 | AC | 0 ms
5,376 KB |
testcase_15 | AC | 1 ms
5,376 KB |
testcase_16 | AC | 0 ms
5,376 KB |
testcase_17 | AC | 1 ms
5,376 KB |
testcase_18 | AC | 0 ms
5,376 KB |
testcase_19 | AC | 0 ms
5,376 KB |
testcase_20 | AC | 1 ms
5,376 KB |
testcase_21 | AC | 1 ms
5,376 KB |
testcase_22 | AC | 0 ms
5,376 KB |
testcase_23 | AC | 0 ms
5,376 KB |
testcase_24 | AC | 1 ms
5,376 KB |
testcase_25 | AC | 1 ms
5,376 KB |
testcase_26 | AC | 0 ms
5,376 KB |
コンパイルメッセージ
main.c: In function ‘g’: main.c:3:3: warning: type of ‘x’ defaults to ‘int’ [-Wimplicit-int] 3 | l g(x){return x>0?(l)x*-~x/2:0;} | ^ main.c: At top level: main.c:4:1: warning: return type defaults to ‘int’ [-Wimplicit-int] 4 | f(u,v,x,y,d,t){ | ^ main.c: In function ‘f’: main.c:4:1: warning: type of ‘u’ defaults to ‘int’ [-Wimplicit-int] main.c:4:1: warning: type of ‘v’ defaults to ‘int’ [-Wimplicit-int] main.c:4:1: warning: type of ‘x’ defaults to ‘int’ [-Wimplicit-int] main.c:4:1: warning: type of ‘y’ defaults to ‘int’ [-Wimplicit-int] main.c:4:1: warning: type of ‘d’ defaults to ‘int’ [-Wimplicit-int] main.c:4:1: warning: type of ‘t’ defaults to ‘int’ [-Wimplicit-int] main.c: At top level: main.c:13:1: warning: return type defaults to ‘int’ [-Wimplicit-int] 13 | main(u,v,x,y,d){ | ^~~~ main.c: In function ‘main’: main.c:13:1: warning: type of ‘u’ defaults to ‘int’ [-Wimplicit-int] main.c:13:1: warning: type of ‘v’ defaults to ‘int’ [-Wimplicit-int] main.c:13:1: warning: type of ‘x’ defaults to ‘int’ [-Wimplicit-int] main.c:13:1: warning: type of ‘y’ defaults to ‘int’ [-Wimplicit-int] main.c:13:1: warning: type of ‘d’ defaults to ‘int’ [-Wimplicit-int] main.c:14:9: warning: implicit declaration of function ‘scanf’ [-Wimplicit-function-declaration] 14 | 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 | typedef long long l; main.c:14:9: warning: incompatible implicit declaration of built-in function ‘scanf’ [-Wbuiltin-declaration-mismatch] 14 | scanf("%d%d%d%d%d",&u,&v,&x,&y,&d); | ^~~~~ main.c:14:9: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’ main.c:19:12: warning: implicit declaration of function ‘printf’ [-Wimplicit-functi
ソースコード
typedef long long l; l s; l g(x){return x>0?(l)x*-~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?~(l)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("%llu",s); }