結果
| 問題 | No.3796 Fanmade Tile Distance |
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2026-11-17 10:25:50 |
| 言語 | C++17 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 85 ms / 2,000 ms |
| + 807µs | |
| コード長 | 627 bytes |
| 記録 | |
| コンパイル時間 | 214 ms |
| コンパイル使用メモリ | 56,172 KB |
| 実行使用メモリ | 9,836 KB |
| 最終ジャッジ日時 | 2026-11-17 10:25:55 |
| 合計ジャッジ時間 | 4,653 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge4_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 6 |
ソースコード
/* -*- coding: utf-8 -*-
*
* 3796.cc: No.3796 Fanmade Tile Distance - yukicoder
*/
#include<cstdio>
#include<algorithm>
using namespace std;
/* constant */
/* typedef */
/* global variables */
/* subroutines */
int calc(int x, int a) {
return (x >= 0) ? x / a : (x + 1) / a - 1;
}
/* main */
int main() {
int tn;
scanf("%d", &tn);
while (tn--) {
int a, b, sx, sy, tx, ty;
scanf("%d%d%d%d%d%d", &a, &b, &sx, &sy, &tx ,&ty);
int si = calc(sx, a);
int sj = calc(sy, b);
int ti = calc(tx, a);
int tj = calc(ty, b);
printf("%d\n", abs(ti - si) + abs(tj - sj));
}
return 0;
}
tnakao0123