結果
問題 | No.1034 テスターのふっぴーさん |
ユーザー |
|
提出日時 | 2020-04-25 09:35:58 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 1,073 bytes |
コンパイル時間 | 2,357 ms |
コンパイル使用メモリ | 191,516 KB |
最終ジャッジ日時 | 2025-01-10 00:55:23 |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 |
ソースコード
#include <bits/stdc++.h>using namespace std;typedef long long ll;typedef long double ld;typedef pair<int,int> P;typedef pair<ll,ll> l_l;typedef vector<int> vi;typedef vector<vi> vvi;typedef vector<ll> vl;typedef vector<P> vp;#define pb push_back#define sz(x) (int)(x).size()#define fi first#define se second#define rep(i,n) for(int i = 0; i < (n); ++i)#define rrep(i,n) for(int i = 1; i <= (n); ++i)#define drep(i,n) for(int i = (n)-1; i >= 0; --i)const int INF=1001001000;const int mINF=-1001001000;const ll LINF=1010010010010010000;template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}//グリッド:(典型)dp,dfs,bfs,最短経路,その他void solve(){ll n,i,j;cin>>n>>i>>j;ll k=min({i,j,n-1-i,n-1-j});ll ans=4*k*(n-k)+2*(n-2*k-1)+(2*(n-1-k)-(i+j))*(i<=j?-1:1);cout<<ans<<endl;return;}int main(){ll q;cin>>q;while(q--){solve();}return 0;}