結果
| 問題 |
No.1034 テスターのふっぴーさん
|
| コンテスト | |
| ユーザー |
saswata de
|
| 提出日時 | 2020-04-24 22:05:12 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 1,905 bytes |
| コンパイル時間 | 1,792 ms |
| コンパイル使用メモリ | 169,608 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-15 02:53:51 |
| 合計ジャッジ時間 | 2,426 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 30 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fd(i,a,b) for(ll i=a;i>=b;i--)
#define rep(it,a) for(auto it: a)
#define pb emplace_back
#define mp make_pair
#define vll vector<ll>
#define pll pair<ll,ll>
#define MOD (1000LL*1000*1000+7)
#define INF (MOD*MOD)
#define F first
#define S second
#define all(a) a.begin(),a.end()
#define tri pair<ll,pll>
#define vpll vector<pll>
#define vvll vector<vll>
#define LL(t) ll t;cin>>t
#define VLL(v,n) vll v(n);f(i,0,n){cin>>v[i];}
ll power(ll a, ll b, ll mod) { // return (a^b)%mod
if(b==0) return 1;
ll half=power(a,b / 2,mod);
ll full=(half*half)%mod;
return (b%2) ? (a*full)%mod : full;
}
ll divMod(ll a, ll b, ll mod){ // return (a/b) % mod , works iff a%b=0
return ((a%mod)*(power(b, MOD-2, MOD)))%mod;
}
bool comp(tri & a, tri &b){
if(a.first!=b.first)
return a.first < b.first;
else{
if(a.S.F!=b.S.F)
return a.S.F < b.S.F;
else
return a.S.S < b.S.S;
}
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
LL(q);
while (q--){
ll n,a,b;
cin>>n>>a>>b;
// n=5,a=(25-q-1)/5,b=(25-q-1)%5;
// cout<<a<<" "<<b<<" ";
ll num=min(min(a,b),min(n-1-a,n-1-b));
ll ind=n*num*2+2*num*(n-2*num)-1;
if(num==a){
cout<<ind+b+1-num<<endl;
}else{
ind+=n-2*num;
if(num==n-1-b){
cout<<ind+a-num<<endl;
}else{
ind+=n-2*num-1;
if(num==n-1-a){
cout<<ind+(n-1-num)-b<<endl;
}else{
ind+=n-2*num-1;
cout<<ind+(n-1-num)-a<<endl;
}
}
}
}
return 0;
}
saswata de