結果
| 問題 |
No.1034 テスターのふっぴーさん
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-07-03 19:14:25 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 790 bytes |
| コンパイル時間 | 1,733 ms |
| コンパイル使用メモリ | 193,608 KB |
| 最終ジャッジ日時 | 2025-01-11 14:09:15 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 TLE * 10 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for (int i=(int)(b); i<(int)(e); i++)
#define ALL(x) (x).begin(), (x).end()
const double PI = acos(-1);
long long solve(long long n, long long y, long long x) {
long long ret = 0;
while (y != 0 && y != n-1 && x != 0 && x != n-1) {
ret += 4 * n - 4;
n -= 2;
--x;
--y;
}
if (y == 0)
ret += x;
else if (x == n-1)
ret += n - 1 + y;
else if (y == n-1)
ret += 2 * n - 2 + n - 1 - x;
else
ret += 3 * n - 3 + n - 1 - y;
return ret;
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int q;
cin >> q;
while (q--) {
int n, y, x;
cin >> n >> y >> x;
cout << solve(n, y, x) << endl;
}
return 0;
}