結果

問題 No.846 メダル
ユーザー LayCurseLayCurse
提出日時 2019-07-06 15:23:02
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,797 bytes
コンパイル時間 2,380 ms
コンパイル使用メモリ 195,108 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-16 08:33:18
合計ジャッジ時間 2,978 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 2 ms
6,944 KB
testcase_08 AC 2 ms
6,944 KB
testcase_09 AC 2 ms
6,944 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 2 ms
6,940 KB
testcase_12 AC 2 ms
6,944 KB
testcase_13 AC 2 ms
6,940 KB
testcase_14 AC 2 ms
6,940 KB
testcase_15 AC 2 ms
6,940 KB
testcase_16 AC 2 ms
6,940 KB
testcase_17 AC 2 ms
6,940 KB
testcase_18 AC 2 ms
6,944 KB
testcase_19 AC 2 ms
6,940 KB
testcase_20 AC 2 ms
6,944 KB
testcase_21 AC 2 ms
6,940 KB
testcase_22 AC 2 ms
6,944 KB
testcase_23 AC 2 ms
6,944 KB
testcase_24 AC 2 ms
6,944 KB
testcase_25 AC 2 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
template<class S, class T> inline S min_L(S a,T b){
  return a<=b?a:b;
}
template<class S, class T> inline S max_L(S a,T b){
  return a>=b?a:b;
}
inline void rd(long long &x){
  int k, m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  char f[10];
  int m=0, s=0;
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
inline void wt_L(long long x){
  char f[20];
  int m=0, s=0;
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
long long P;
long long Q;
long long R;
long long A;
long long B;
long long C;
int main(){
  int ok;
  long long i, j, k, x, y;
  rd(P);
  rd(Q);
  rd(R);
  rd(A);
  rd(B);
  rd(C);
  B += A;
  C += B;
  x =max_L(max_L(P*(A-1), Q*(B-1)), R*(C-1))+ 1;
  y =min_L(min_L(P*A, Q*B), R*C);
  if(x > y){
    wt_L(-1);
    wt_L('\n');
  }
  else{
    wt_L(x);
    wt_L(' ');
    wt_L(y);
    wt_L('\n');
  }
  return 0;
}
// cLay varsion 20190706-1

// --- original code ---
// ll P, Q, R, A, B, C;
// {
//   ll i, j, k;
//   ll x, y;
//   int ok;
// 
//   rd(P,Q,R,A,B,C);
//   B += A;
//   C += B;
//   
//   x = max(P*(A-1), Q*(B-1), R*(C-1)) + 1;
//   y = min(P*A, Q*B, R*C);
// 
//   if(x > y) wt(-1); else wt(x,y);
// }
0