Submission #2446961


Source Code Expand

#include <bits/stdc++.h>

using namespace std;

#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)

int in() { int x; scanf("%d", &x); return x; }
template<typename T> void pv(T a, T b) { for (T i = a; i < b; i++) cout << *i << ' '; cout << endl; }
template<typename T, typename U> void chmin(T &x, U y) { if (y < x) x = y; }
template<typename T, typename U> void chmax(T &x, U y) { if (x < y) x = y; }

int main() {
  int A,B,C,X,Y;

  cin >> A >> B >> C >> X >> Y;

  int cost = (1<<30);
  REP(c,200010) {
    int a = max(X - c / 2, 0);
    int b = max(Y - c / 2, 0);
    int x = a * A + b * B + c * C;
    chmin(cost, x);
  }

  cout << cost << endl;

  return 0;
}

Submission Info

Submission Time
Task C - Half and Half
User jyane
Language C++14 (GCC 5.4.1)
Score 300
Code Size 699 Byte
Status AC
Exec Time 2 ms
Memory 256 KiB

Compile Error

./Main.cpp: In function ‘int in()’:
./Main.cpp:7:34: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
 int in() { int x; scanf("%d", &x); return x; }
                                  ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 15
Set Name Test Cases
Sample a01, a02, a03
All a01, a02, a03, b04, b05, b06, b07, b08, b09, b10, b11, b12, b13, b14, b15
Case Name Status Exec Time Memory
a01 AC 2 ms 256 KiB
a02 AC 2 ms 256 KiB
a03 AC 2 ms 256 KiB
b04 AC 2 ms 256 KiB
b05 AC 2 ms 256 KiB
b06 AC 2 ms 256 KiB
b07 AC 2 ms 256 KiB
b08 AC 2 ms 256 KiB
b09 AC 2 ms 256 KiB
b10 AC 2 ms 256 KiB
b11 AC 2 ms 256 KiB
b12 AC 2 ms 256 KiB
b13 AC 2 ms 256 KiB
b14 AC 2 ms 256 KiB
b15 AC 2 ms 256 KiB