結果
問題 |
No.3288 Sloppy Land Grading
|
ユーザー |
![]() |
提出日時 | 2025-10-03 21:35:18 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 307 ms / 2,000 ms |
コード長 | 465 bytes |
コンパイル時間 | 2,608 ms |
コンパイル使用メモリ | 283,756 KB |
実行使用メモリ | 7,716 KB |
最終ジャッジ日時 | 2025-10-03 21:35:26 |
合計ジャッジ時間 | 6,852 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 16 |
ソースコード
#include<bits/stdc++.h> using namespace std; void solve(){ using ll=long long; ll a,b,c,x,y,z; cin>>a>>b>>c>>x>>y>>z; vector<pair<ll,ll>> vp={{a,x},{b,y},{c,z}}; sort(vp.begin(),vp.end()); ll ans=1e18; auto f=[&](ll pos){ ll cost=0; for (int i=0;i<3;i++) cost+=abs(vp[i].first-pos)*vp[i].second; ans=min(ans,cost); }; for (int i=0;i<3;i++) f(vp[i].first); cout<<ans<<endl; } int main(){ int t; cin>>t; while (t--) solve(); }