結果
問題 | No.1034 テスターのふっぴーさん |
ユーザー |
![]() |
提出日時 | 2020-04-24 22:51:37 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 567 bytes |
コンパイル時間 | 6,476 ms |
コンパイル使用メモリ | 193,056 KB |
最終ジャッジ日時 | 2025-01-10 00:22:48 |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 |
ソースコード
#include <bits/stdc++.h>using namespace std;int64_t solve(int64_t n, int64_t i, int64_t j) {int lines = min({i, j, n - 1 - i, n - 1 - j});if (lines) {return 4 * lines * (n - lines) + solve(n - 2 * lines, i - lines, j - lines);}if (i == 0) return j;if (j == n - 1) return n - 1 + i;if (i == n - 1) return 3 * (n - 1) - j;return 4 * (n - 1) - i;}int main() {int q;cin >> q;for (int i = 0; i < q; i++) {int64_t n, x, y;cin >> n >> x >> y;cout << solve(n, x, y) << endl;}}