結果
問題 | No.1034 テスターのふっぴーさん |
ユーザー |
![]() |
提出日時 | 2020-04-25 00:31:17 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 4 ms / 2,000 ms |
コード長 | 846 bytes |
コンパイル時間 | 1,615 ms |
コンパイル使用メモリ | 122,176 KB |
最終ジャッジ日時 | 2025-01-10 00:46:06 |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 |
ソースコード
#include <cstdio>#include <cstring>#include <iostream>#include <string>#include <cmath>#include <bitset>#include <vector>#include <map>#include <set>#include <queue>#include <deque>#include <algorithm>#include <complex>#include <unordered_map>#include <unordered_set>#include <random>#include <cassert>#include <fstream>#include <utility>#include <functional>#include <time.h>#include <stack>#include <array>#define popcount __builtin_popcountusing namespace std;typedef long long int ll;typedef pair<int, int> P;int main(){int q; cin>>q;while(q--){ll n, x, y;cin>>n>>x>>y;ll d=min({x, n-1-x, y, n-1-y});x-=d, y-=d;ll ans=4*(n-1)*d-4*d*(d-1);if(x==0) ans+=y;else if(x==n-1-2*d) ans+=3*(n-1-2*d)-y;else if(y==0) ans+=4*(n-1-2*d)-x;else ans+=n-1-2*d+x;cout<<ans<<endl;}return 0;}