結果
問題 | No.1034 テスターのふっぴーさん |
ユーザー |
|
提出日時 | 2020-04-24 22:04:06 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 670 bytes |
コンパイル時間 | 1,503 ms |
コンパイル使用メモリ | 167,676 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-15 02:52:44 |
合計ジャッジ時間 | 2,409 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 |
ソースコード
#include <bits/stdc++.h>#define rep(i,n) for(int i=0;i<n;i++)using namespace std;using ll = long long ;using P = pair<int,int> ;const int INF = 1e9;const int MOD = 1000000007;void solve(){ll N,I,J;cin >> N >> I >> J;ll k = min({I,J,N-1-J,N-1-I});ll ans = 4*k*(N-k);if(k==I){ans += J-k+1;}else if(k==N-1-J){ans += N-2*k-1;ans += I-k+1;}else if(k==N-1-I){ans += 2*(N-2*k-1);ans += N-k-J;}else if(k==J){ans += 3*N-6*k-3;ans += N-k-I;}cout << ans-1 << endl;return;}int main(){int q;cin >> q;rep(i,q) solve();return 0;}