結果
問題 |
No.1034 テスターのふっぴーさん
|
ユーザー |
![]() |
提出日時 | 2022-05-15 02:18:29 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 62 ms / 2,000 ms |
コード長 | 431 bytes |
コンパイル時間 | 1,929 ms |
コンパイル使用メモリ | 192,460 KB |
最終ジャッジ日時 | 2025-01-29 08:13:11 |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 |
ソースコード
#include <bits/stdc++.h> using namespace std; int64_t f(int64_t n, int64_t y, int64_t x) { int64_t k = min({y, x, n - 1 - y, n - 1 - x}); int64_t sum = 4 * k * (n - k); int64_t rd = 2 * (n - 2 * k - 1); int64_t diff = (2 * (n - 1 - k) - (y + x)) * (y <= x ? -1 : +1); return sum + rd + diff; } int main() { int q; cin >> q; while(q--) { int64_t n, i, j; cin >> n >> i >> j; cout << f(n, i, j) << '\n'; } return 0; }