結果
| 問題 | No.3288 Sloppy Land Grading | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2025-10-05 01:45:58 | 
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 65 ms / 2,000 ms | 
| コード長 | 673 bytes | 
| コンパイル時間 | 3,186 ms | 
| コンパイル使用メモリ | 283,240 KB | 
| 実行使用メモリ | 7,716 KB | 
| 最終ジャッジ日時 | 2025-10-05 01:46:04 | 
| 合計ジャッジ時間 | 5,663 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 16 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, e) for (int i = (int)(s); i < (int)(e); ++i)
int main() {
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	
	int T;
	cin >> T;
	
	rep(test, 0, T) {
		vector<pair<ll, ll>> A(3);
		rep(i, 0, 3) cin >> A[i].first;
		rep(i, 0, 3) cin >> A[i].second;
		
		sort (A.begin(), A.end());
		
		ll sum = 0;
		rep(i, 0, 3) sum += A[i].second;
		
		ll w;
		if (A[0].second >= sum/2 + 1) w = A[0].first;
		else if (A[0].second + A[1].second >= sum/2 + 1) w = A[1].first;
		else w = A[2].first;
		
		ll ans = 0;
		rep(i, 0, 3) ans += A[i].second * abs(A[i].first - w);
		cout << ans << '\n';
	}
}
            
            
            
        