結果

問題 No.3288 Sloppy Land Grading
ユーザー Hydrogen332
提出日時 2025-10-05 01:39:42
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 611 bytes
コンパイル時間 3,084 ms
コンパイル使用メモリ 281,832 KB
実行使用メモリ 15,940 KB
最終ジャッジ日時 2025-10-05 01:39:50
合計ジャッジ時間 7,769 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 6 TLE * 1 -- * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

#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) {
		ll A, B, C, x, y, z;
		cin >> A >> B >> C >> x >> y >> z;
		
		ll sum = x + y + z;
		vector<ll> V(sum);
		rep(i, 0, x) V[i] = A;
		rep(i, 0, y) V[i + x] = B;
		rep(i, 0, z) V[i + x + y] = C;
		
		sort(V.begin(), V.end());
		
		ll ans = 0;
		ans += x * abs(A - V[sum / 2]);
		ans += y * abs(B - V[sum / 2]);
		ans += z * abs(C - V[sum / 2]);
		cout << ans << '\n';
	}
}
0