結果

問題 No.3288 Sloppy Land Grading
ユーザー 00 Sakuda
提出日時 2025-10-04 01:49:05
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 360 ms / 2,000 ms
コード長 527 bytes
コンパイル時間 1,177 ms
コンパイル使用メモリ 111,488 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-10-04 01:49:13
合計ジャッジ時間 6,583 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <iomanip>
#include <numeric>
using namespace std;
using ll = long long;
void solve() {
	int N = 3;
	vector<ll> A(N), X(N);
	for (int i = 0;i < N;i++) cin >> A[i];
	for (int i = 0;i < N;i++) cin >> X[i];
	ll res = (1LL << 60);
	for (int i = 0;i < N;i++) {
		ll sc = 0;
		for (int j = 0;j < N;j++) sc += X[j] * abs(A[i]-A[j]);
		res = min(res, sc);
	}	
	cout << res << endl;
}
int main() {
	int t;cin >> t;
	while (t--) solve();
}
0