結果

問題 No.2110 012 Matching
ユーザー nyyanyya
提出日時 2022-12-17 16:46:00
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 301 ms / 2,000 ms
コード長 928 bytes
コンパイル時間 3,468 ms
コンパイル使用メモリ 226,572 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-10 17:19:33
合計ジャッジ時間 7,901 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 78 ms
4,380 KB
testcase_02 AC 209 ms
4,376 KB
testcase_03 AC 138 ms
4,380 KB
testcase_04 AC 268 ms
4,376 KB
testcase_05 AC 183 ms
4,380 KB
testcase_06 AC 178 ms
4,376 KB
testcase_07 AC 297 ms
4,376 KB
testcase_08 AC 12 ms
4,376 KB
testcase_09 AC 43 ms
4,376 KB
testcase_10 AC 301 ms
4,376 KB
testcase_11 AC 1 ms
4,376 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