結果
| 問題 | No.325 マンハッタン距離2 |
| コンテスト | |
| ユーザー |
testestest
|
| 提出日時 | 2016-06-30 05:53:56 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 1,000 ms |
| コード長 | 385 bytes |
| コンパイル時間 | 203 ms |
| コンパイル使用メモリ | 20,352 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-11 23:12:43 |
| 合計ジャッジ時間 | 1,068 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 24 |
コンパイルメッセージ
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<=0&x2>=0&y1<=0&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);
}
testestest