結果

問題 No.1034 テスターのふっぴーさん
ユーザー 里旬里旬
提出日時 2020-04-24 21:32:18
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 594 bytes
コンパイル時間 2,559 ms
コンパイル使用メモリ 192,068 KB
最終ジャッジ日時 2025-01-09 23:15:52
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int q;
    cin >> q;
    while(q--){
        int64_t n, i, j;
        cin >> n >> i >> j;
        int64_t lv = min({i, j, n-1-i, n-1-j});
        int64_t st = n*n - (n-2*lv)*(n-2*lv);
        i -= lv; j -= lv; n -= 2*lv;
        if(i == 0) cout << st + j << endl;
        else if(j == n-1) cout << st + n-1 + i << endl;
        else if(i == n-1) cout << st + n-1 + n-1 + n-1-j << endl;
        else cout << st + n-1 + n-1 + n-1 + n-1-i << endl;
    }
    
    
    return 0;
}
0