結果
問題 |
No.3288 Sloppy Land Grading
|
ユーザー |
|
提出日時 | 2025-10-03 21:30:36 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 70 ms / 2,000 ms |
コード長 | 825 bytes |
コンパイル時間 | 1,546 ms |
コンパイル使用メモリ | 195,100 KB |
実行使用メモリ | 7,716 KB |
最終ジャッジ日時 | 2025-10-03 21:30:46 |
合計ジャッジ時間 | 3,507 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 16 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int T; cin >> T; while(T--){ long long a,b,c,x,y,z; cin >> a >> b >> c >> x >> y >> z; if(x > y) swap(a,b),swap(x,y); if(y > z) swap(b,c),swap(y,z); if(x > y) swap(a,b),swap(x,y); long long answer = 0; if(x+y <= z) answer += abs(c-a)*x+abs(c-b)*y; else{ if(min({c,a,b}) == c || max({c,a,b}) == c){ if(max({c,a,b}) == c) a *= -1,b *= -1,c *= -1; long long move = min(a,b)-c; answer += z*move+abs(b-min(a,b))*y+abs(a-min(a,b))*x; } else{ answer += abs(c-a)*x+abs(c-b)*y; } } cout << answer << "\n"; } }