提出 #52873009
ソースコード 拡げる
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
long long dis_calc(long long a, long long b, long long c, long long d){
long long dis = 0;
if((a + b) % 2 != (c + d) % 2){
dis = 0;
} else {
long long x_sa = llabs(a - c);
long long y_sa = llabs(b - d);
if(x_sa > y_sa){
dis = x_sa;
} else {
dis = y_sa;
}
}
return dis;
}
int main(){
int N;
scanf("%d", &N);
long long X[N], Y[N];
for(int i = 0; i < N; i++){
scanf("%lld %lld", &X[i], &Y[i]);
}
long long sum = 0;
for(int i = 0; i < N-1; i++){
for(int j = i + 1; j < N; j++){
sum += dis_calc(X[i], Y[i], X[j], Y[j]);
}
}
printf("%lld\n", sum);
return 0;
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | E - Jump Distance Sum |
| ユーザ | oinucha |
| 言語 | C (gcc 12.2.0) |
| 得点 | 0 |
| コード長 | 825 Byte |
| 結果 | TLE |
| 実行時間 | 2211 ms |
| メモリ | 4644 KiB |
コンパイルエラー
Main.c: In function ‘main’:
Main.c:23:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
23 | scanf("%d", &N);
| ^~~~~~~~~~~~~~~
Main.c:26:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
26 | scanf("%lld %lld", &X[i], &Y[i]);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ジャッジ結果
| セット名 | Sample | All | ||||||
|---|---|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 0 / 500 | ||||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | example_00.txt, example_01.txt |
| All | example_00.txt, example_01.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| example_00.txt | AC | 0 ms | 1684 KiB |
| example_01.txt | AC | 1 ms | 1604 KiB |
| hand_00.txt | TLE | 2207 ms | 4608 KiB |
| hand_01.txt | AC | 1 ms | 1620 KiB |
| hand_02.txt | TLE | 2207 ms | 4608 KiB |
| hand_03.txt | TLE | 2207 ms | 4608 KiB |
| hand_04.txt | AC | 1 ms | 1608 KiB |
| random_00.txt | TLE | 2210 ms | 4596 KiB |
| random_01.txt | TLE | 2207 ms | 4592 KiB |
| random_02.txt | TLE | 2207 ms | 4584 KiB |
| random_03.txt | TLE | 2211 ms | 4488 KiB |
| random_04.txt | TLE | 2207 ms | 4636 KiB |
| random_05.txt | TLE | 2207 ms | 4588 KiB |
| random_06.txt | TLE | 2207 ms | 4560 KiB |
| random_07.txt | TLE | 2207 ms | 4620 KiB |
| random_08.txt | TLE | 2210 ms | 4580 KiB |
| random_09.txt | TLE | 2207 ms | 4604 KiB |
| random_10.txt | TLE | 2207 ms | 4608 KiB |
| random_11.txt | TLE | 2207 ms | 4628 KiB |
| random_12.txt | TLE | 2207 ms | 4560 KiB |
| random_13.txt | TLE | 2207 ms | 4644 KiB |
| random_14.txt | TLE | 2207 ms | 4636 KiB |
| random_15.txt | TLE | 2207 ms | 4624 KiB |
| random_16.txt | TLE | 2207 ms | 4608 KiB |
| random_17.txt | TLE | 2207 ms | 4604 KiB |
| random_18.txt | TLE | 2207 ms | 4556 KiB |
| random_19.txt | TLE | 2207 ms | 4560 KiB |