結果

問題 No.3288 Sloppy Land Grading
ユーザー eQe
提出日時 2025-10-03 21:56:22
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 64 ms / 2,000 ms
コード長 1,057 bytes
コンパイル時間 3,030 ms
コンパイル使用メモリ 276,040 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-10-03 21:56:28
合計ジャッジ時間 5,636 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#if __has_include(<atcoder/all>)
#endif
using namespace std;
#define LL(...) ll __VA_ARGS__;lin(__VA_ARGS__)
#define FO(n) for(ll IJK=n;IJK-->0;)
#define defpp template<ostream&o=cout>void pp(const auto&...a){[[maybe_unused]]const char*c="";((o<<c<<a,c=" "),...);o<<'\n';}void epp(const auto&...a){pp<cerr>(a...);}
#define entry defpp void main();void main2();}int main(){my::io();my::main();}namespace my{
#define multiple_testcases LL(T);FO(T)main2();}void main2(){
namespace my{
void io(){cin.tie(nullptr)->sync_with_stdio(0);cout<<fixed<<setprecision(15);}
using ll=long long;
void lin(auto&...a){(cin>>...>>a);}
auto min(auto...a){return min(initializer_list<common_type_t<decltype(a)...>>{a...});}
}
namespace my{entry
void main(){
  multiple_testcases
  LL(A,B,C,x,y,z);

  if(A>B)swap(A,B),swap(x,y);
  if(B>C)swap(B,C),swap(y,z);
  if(A>B)swap(A,B),swap(x,y);

  auto f1=[&](ll T){
    return (T-A)*x+(B-T)*y+(C-T)*z;
  };
  auto f2=[&](ll T){
    return (T-A)*x+(T-B)*y+(C-T)*z;
  };

  pp(min(f1(A),f1(B),f2(B),f2(C)));
}}
0