結果
問題 |
No.1034 テスターのふっぴーさん
|
ユーザー |
![]() |
提出日時 | 2020-04-24 22:49:54 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 551 bytes |
コンパイル時間 | 2,572 ms |
コンパイル使用メモリ | 192,924 KB |
最終ジャッジ日時 | 2025-01-10 00:19:27 |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 WA * 10 |
ソースコード
#include <bits/stdc++.h> using namespace std; int64_t solve(int n, int i, int 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++) { int n, x, y; cin >> n >> x >> y; cout << solve(n, x, y) << endl; } }