結果
問題 |
No.3288 Sloppy Land Grading
|
ユーザー |
|
提出日時 | 2025-10-03 21:54:47 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 316 ms / 2,000 ms |
コード長 | 602 bytes |
コンパイル時間 | 502 ms |
コンパイル使用メモリ | 78,220 KB |
実行使用メモリ | 7,716 KB |
最終ジャッジ日時 | 2025-10-03 21:54:56 |
合計ジャッジ時間 | 5,021 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 16 |
ソースコード
#include<iostream> #include<vector> #include<queue> #include<algorithm> using namespace std; using ll = long long; void solve(){ ll a[3], cost[3]; for(int i=0; i<3; i++) cin >> a[i]; for(int i=0; i<3; i++) cin >> cost[i]; if(a[0]>a[1]) swap(a[0], a[1]), swap(cost[0], cost[1]); if(a[1]>a[2]) swap(a[1], a[2]), swap(cost[1], cost[2]); ll ans=1e18; for(int i=0; i<3; i++){ ll now=0; for(int j=0; j<3; j++){ now+=abs(a[j]-a[i])*cost[j]; } ans=min(ans, now); } cout << ans << '\n'; } int main(void){ int t; cin >> t; while(t--){ solve(); } return 0; }