結果

問題 No.2110 012 Matching
ユーザー nyyanyya
提出日時 2022-12-17 16:46:00
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 328 ms / 2,000 ms
コード長 928 bytes
コンパイル時間 3,434 ms
コンパイル使用メモリ 228,896 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-28 10:43:23
合計ジャッジ時間 7,501 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,816 KB
testcase_01 AC 83 ms
6,940 KB
testcase_02 AC 210 ms
6,940 KB
testcase_03 AC 143 ms
6,940 KB
testcase_04 AC 274 ms
6,944 KB
testcase_05 AC 194 ms
6,944 KB
testcase_06 AC 191 ms
6,940 KB
testcase_07 AC 328 ms
6,944 KB
testcase_08 AC 12 ms
6,944 KB
testcase_09 AC 45 ms
6,940 KB
testcase_10 AC 316 ms
6,940 KB
testcase_11 AC 2 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define rep(i,n) for(int i=0;i<(n);i++)
#define per(i,n) for(int i=(n)-1;i>=0;i--)
#define all(x) x.begin(),x.end()
typedef long long ll;
//using mint = modint;
using mint = modint998244353;
//using mint = modint1000000007;
using P = pair<int, int>;

const ll INF=1LL<<60, dx[]={0,1,0,-1},dy[]={1,0,-1,0};
template <typename T> inline bool chmin(T& a,const T&b) {if(a>b){a=b; return 1;} return 0;}
template <typename T> inline bool chmax(T& a,const T&b) {if(a<b){a=b; return 1;} return 0;}

ll solve() {
    ll a,b,c;
    cin >> a >> b >> c;

    ll ans=0;
    ll ac=min(a,c);
    ll b2=b/2;

    ans+=ac*2;
    a-=ac;
    c-=ac;
    ans+=b2*2;
    b-=(b2*2);

    if(a>0) ans+=b;
    else ans+=(c/2);

    return ans;
}

int main(){

    int t;
    cin >> t;
    while(t--) {
        cout << solve() << endl;;
    }

    return 0;

}
0