結果

問題 No.453 製薬会社
ユーザー rickythetarickytheta
提出日時 2016-12-04 02:32:41
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,669 bytes
コンパイル時間 1,489 ms
コンパイル使用メモリ 151,012 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-18 14:02:07
合計ジャッジ時間 2,290 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-09;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int main(){
  double c,d;
  cin>>c>>d;
  // max 1000x + 2000y
  //     3/4x + 2/7y <= c
  //     1/4x + 5/7y <= d

  // 21x+8y=28c
  // 7x+20y=28d
  // y = -7/20x+28/20d
  // 21x-14/5x+56/5d=28c
  // (21-14/5)x=28c-56/5d
  typedef pair<double,double> pdd;
  set<pdd> S;
  S.insert(pdd(0,c*7.0/2.0));
  S.insert(pdd(0,d*7.0/5.0));
  S.insert(pdd(c*4.0/3.0,0));
  S.insert(pdd(d*4.0/1.0,0));
  double xx = (28.0*c-d*56.0/5.0)/(21.0 - 14.0/5.0);
  double yy = -7.0/20.0*xx+28.0/20.0*d;
  S.insert(pdd(xx,yy));
  double ans = 0.0;
  for(auto P:S){
    double x = P.first;
    double y = P.second;
    double v = 1000.0*x + 2000.0*y;
    double usec = x*3.0/4.0 + y*2.0/7.0;
    double used = x*1.0/4.0 + y*5.0/7.0;
    if(x>-EPS && y>-EPS && c>usec-EPS && d>used-EPS){
      CHMAX(ans,v);
    }
  }
  printf("%.9f\n",ans);
  return 0;
}
0