結果

問題 No.3173 じゃんけんの勝ちの回数
ユーザー 沙耶花
提出日時 2025-06-06 21:35:40
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 60 ms / 2,000 ms
コード長 764 bytes
コンパイル時間 4,380 ms
コンパイル使用メモリ 265,244 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-06-06 21:35:48
合計ジャッジ時間 7,787 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
using mint = modint998244353;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000005
#define Inf64 4000000000000000001LL


int main(){
	
	int _t;
	cin>>_t;
	rep(_,_t){
		vector<long long> a(3),b(3);
		rep(i,3)cin>>a[i];
		rep(i,3)cin>>b[i];
		{
			mcf_graph<long long,long long> g(8);
			rep(i,3){
				rep(j,3){
					int cost = 0;
					if((i+1)%3==j)cost = 1;
					g.add_edge(i,j+3,100000000,cost);
				}
			}
			rep(i,3){
				g.add_edge(6,i,a[i],0);
				g.add_edge(i+3,7,b[i],0);
			}
			cout<<g.flow(6,7).second<<' ';
		}
		long long ans = 0;
		rep(i,3){
			ans += min(a[i],b[(i+1)%3]);
		}
		cout<<ans<<endl;
		
	}
			
	return 0;
}
0