結果
問題 | No.1034 テスターのふっぴーさん |
ユーザー |
|
提出日時 | 2020-05-01 11:33:29 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 4 ms / 2,000 ms |
コード長 | 703 bytes |
コンパイル時間 | 996 ms |
コンパイル使用メモリ | 86,104 KB |
最終ジャッジ日時 | 2025-01-10 03:56:44 |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 |
ソースコード
#include <iostream>#include <algorithm>#include <cmath>using lint = long long;void solve() {lint n, x, y;std::cin >> n >> x >> y;lint d = std::min({x, n - x - 1, y, n - y - 1});x -= d, y -= d;lint ans = n * n - (n - d * 2) * (n - d * 2);n -= d * 2;if (x == 0) {ans += y;} else if (y == n - 1) {ans += (n - 1) + x;} else if (x == n - 1) {ans += (n - 1) * 2 + (n - 1 - y);} else {ans += (n - 1) * 3 + (n - 1 - x);}std::cout << ans << std::endl;}int main() {std::cin.tie(nullptr);std::ios::sync_with_stdio(false);int q;std::cin >> q;while (q--) solve();return 0;}