結果

問題 No.1034 テスターのふっぴーさん
ユーザー kilalakilala
提出日時 2020-04-24 23:46:57
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 658 bytes
コンパイル時間 542 ms
コンパイル使用メモリ 68,748 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-04-23 04:23:20
合計ジャッジ時間 4,331 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
10,624 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 1 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 1 ms
5,376 KB
testcase_19 AC 2 ms
5,376 KB
testcase_20 TLE -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
using namespace std;
 
int main()
{
    int q, n, i, j;
    cin >> q;
    while (q--) {
        long long ans = 0;
        cin >> n >> i >> j;
        int dep = min(i - 0, min(j - 0, min(n-1-i, n-1-j))) + 1;
        int q = (n-1)* 4, nowl = n - (dep-1) * 2;
        for (int i = 1; i < dep; ++i) ans += q, q -= 2*4; 
        if (i == dep - 1) ans += j - (dep-1);
        else if (j == dep - 1) ans += q - (i - (dep-1));
        else if (i == dep-1 + nowl-1) ans += q  - (nowl-1) - (j - (dep-1));
        else if (j == dep-1 + nowl-1) ans += nowl-1 + (i - (dep-1));

        cout << ans << endl;
    }

    return 0;
}
0