結果
| 問題 |
No.131 マンハッタン距離
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-04 11:05:43 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 491 bytes |
| コンパイル時間 | 1,629 ms |
| コンパイル使用メモリ | 167,152 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-03 07:02:43 |
| 合計ジャッジ時間 | 2,424 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 16 WA * 8 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define llong long long
int main() {
uint x, y, d;
cin >> x >> y >> d;
bool left = y >= d;
bool top = d > y && d <= x + y;
bool right = d >= x && d <= x + y;
bool bottom = d < x;
if(left || top) {
int x0, x1;
x0 = left ? 0 : d - y;
x1 = bottom ? d : y;
cout << x1 - x0 + 1 << endl;
} else {
cout << 0 << endl;
}
}