結果

問題 No.3288 Sloppy Land Grading
ユーザー daiota
提出日時 2025-10-04 00:38:19
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 198 ms / 2,000 ms
コード長 760 bytes
コンパイル時間 1,692 ms
コンパイル使用メモリ 169,356 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-10-04 00:38:25
合計ジャッジ時間 5,578 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P;
#define REP(i,n) for(ll i=0;i<ll(n);i++)









int main() {
	cin.tie(nullptr);  ios_base::sync_with_stdio(false);
	ll i,j;






	int T;
	cin >> T;
	while(T--){


		ll A,B,C,x,y,z;
		cin >> A >> B >> C >> x >> y >> z;

		vector<P> v;
		v.push_back(P(A,x));
		v.push_back(P(B,y));
		v.push_back(P(C,z));

		sort(v.begin(),v.end());

		A=v[0].first;
		B=v[1].first;
		C=v[2].first;
		x=v[0].second;
		y=v[1].second;
		z=v[2].second;


		ll s;
		if(x-y-z>=0) s=(x-y-z)*A-x*A+y*B+z*C;
		else s=(x-y-z)*B-x*A+y*B+z*C;




		ll t;
		if(x+y-z>=0) t=(x+y-z)*B-x*A-y*B+z*C;
		else t=(x+y-z)*C-x*A-y*B+z*C;






		cout << min(s,t) << endl;






	}








    return 0;
}
0