結果
問題 | No.325 マンハッタン距離2 |
ユーザー | 👑 testestest |
提出日時 | 2016-06-30 05:53:09 |
言語 | C90 (gcc 11.4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 380 bytes |
コンパイル時間 | 123 ms |
コンパイル使用メモリ | 20,480 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-11 23:12:36 |
合計ジャッジ時間 | 906 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
6,820 KB |
testcase_01 | AC | 0 ms
6,816 KB |
testcase_02 | AC | 1 ms
6,816 KB |
testcase_03 | AC | 0 ms
6,816 KB |
testcase_04 | AC | 0 ms
6,820 KB |
testcase_05 | AC | 1 ms
6,816 KB |
testcase_06 | AC | 1 ms
6,816 KB |
testcase_07 | AC | 1 ms
6,820 KB |
testcase_08 | AC | 1 ms
6,816 KB |
testcase_09 | AC | 1 ms
6,816 KB |
testcase_10 | AC | 1 ms
6,820 KB |
testcase_11 | AC | 1 ms
6,816 KB |
testcase_12 | AC | 1 ms
6,816 KB |
testcase_13 | AC | 0 ms
6,820 KB |
testcase_14 | AC | 1 ms
6,816 KB |
testcase_15 | AC | 1 ms
6,820 KB |
testcase_16 | AC | 0 ms
6,816 KB |
testcase_17 | AC | 1 ms
6,820 KB |
testcase_18 | AC | 1 ms
6,820 KB |
testcase_19 | AC | 0 ms
6,816 KB |
testcase_20 | AC | 0 ms
6,820 KB |
testcase_21 | WA | - |
testcase_22 | AC | 1 ms
6,820 KB |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | AC | 1 ms
6,820 KB |
コンパイルメッセージ
main.c:1:8: warning: data definition has no type or storage class 1 | long m;x1,x2,y1,y2,d; | ^~ main.c:1:8: warning: type defaults to ‘int’ in declaration of ‘x1’ [-Wimplicit-int] main.c:1:11: warning: type defaults to ‘int’ in declaration of ‘x2’ [-Wimplicit-int] 1 | long m;x1,x2,y1,y2,d; | ^~ main.c:1:14: warning: type defaults to ‘int’ in declaration of ‘y1’ [-Wimplicit-int] 1 | long m;x1,x2,y1,y2,d; | ^~ main.c:1:14: warning: built-in function ‘y1’ declared as non-function [-Wbuiltin-declaration-mismatch] main.c:1:17: warning: type defaults to ‘int’ in declaration of ‘y2’ [-Wimplicit-int] 1 | long m;x1,x2,y1,y2,d; | ^~ main.c:1:20: warning: type defaults to ‘int’ in declaration of ‘d’ [-Wimplicit-int] 1 | long m;x1,x2,y1,y2,d; | ^ main.c:4:1: warning: return type defaults to ‘int’ [-Wimplicit-int] 4 | g(p,q,r,s){ | ^ main.c: In function ‘g’: main.c:4:1: warning: type of ‘p’ defaults to ‘int’ [-Wimplicit-int] main.c:4:1: warning: type of ‘q’ defaults to ‘int’ [-Wimplicit-int] main.c:4:1: warning: type of ‘r’ defaults to ‘int’ [-Wimplicit-int] main.c:4:1: warning: type of ‘s’ defaults to ‘int’ [-Wimplicit-int] main.c: At top level: main.c:11:1: warning: return type defaults to ‘int’ [-Wimplicit-int] 11 | main(){ | ^~~~ main.c: In function ‘main’: main.c:12:9: warning: implicit declaration of function ‘scanf’ [-Wimplicit-function-declaration] 12 | scanf("%d%d%d%d%d",&x1,&y1,&x2,&y2,&d); | ^~~~~ main.c:1:1: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’ +++ |+#include <stdio.h> 1 | long m;x1,x2,y1,y2,d; main.c:12:9: warning: incompatible implicit declaration of built-in function ‘scanf’ [-Wbuiltin-declaration-mismatch] 12 | scanf("%d%d%d%d%d",&x1,&y1,&x2,&y2,&d); |
ソースコード
long m;x1,x2,y1,y2,d; #define max(p,q)(p>q?p:q) #define f(n)(n>0?(n)*(n+1)/2:0) g(p,q,r,s){ long x,y,z; x=p-max(r,0); y=q-max(s,1); z=d-max(r,0)-max(s,1); m+=x>=0&y>=0?f(z+1)-f(z-y)-f(z-x)+f(z-x-y-1):0; } main(){ scanf("%d%d%d%d%d",&x1,&y1,&x2,&y2,&d); m=x1*x2<=0&&y1*y2<=0; g(x2,y2,x1,y1); g(y2,-x1,y1,-x2); g(-x1,-y1,-x2,-y2); g(-y1,x2,-y2,x1); m=!printf("%ld",m); }