Submission #19424109


Source Code Expand

Copy
#include <bits/stdc++.h>
//#include <atcoder/all>
using namespace std;

#define rep(i,x,y) for(ll i=(x);i<(y);i++)
#define rrep(i,x,y) for(ll i=(ll)(y)-1;i>=(x);i--)
#define all(x) (x).begin(),(x).end()
#define itrout(x) for(int i=0;i<x.size();i++) {cout << x[i] << (i==x.size()-1 ? "\n" : " ");}
#ifdef LOCAL
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl
#define debugbit(x, n) cerr << #x << " = " << bitset<n>(x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl
#define itrdebug(x) cerr << #x << " "; for (auto & el : (x)) {cerr << (el) << " ";} cerr << endl
#define dassert(...) assert(__VA_ARGS__)
#else
#define debug(x)
#define debugbit(x, n)
#define itrdebug(x)
#define dassert(...)
#endif
//#define int long long
//using mint = atcoder::modint;

typedef long long ll;
const ll MOD = 1e9 + 7;
const long double EPS = 1e-8;

void solve(long long A, long long B, long long C, long long D, long long E, long long F){
    A *= 100;
    B *= 100;
    double max = 0;
    pair<int, int> answer = {0, 0};
    vector<vector<bool>> dp(F+1, vector<bool>(F+1, false));
    dp[0][0] = true;
    rep(i,0,F+1) rep(j,0,F+1) {
        if (i + j > F || !dp[i][j]) continue;
        if (i != 0 && max < 1.0 * j / i) {
            max = 1.0 * j / i;
            answer = {i, j};
        }
        if (i + j + A <= F && j*100 <= E*(i+A)) dp[i+A][j] = true;
        if (i + j + B <= F && j*100 <= E*(i+B)) dp[i+B][j] = true;
        if (i + j + C <= F && (j+C)*100 <= E*(i)) dp[i][j+C] = true;
        if (i + j + D <= F && (j+D)*100 <= E*(i)) dp[i][j+D] = true;
    }
    cout << answer.first + answer.second << " " << answer.second << endl;
}

signed main(){
    // ios_base::sync_with_stdio(false);
    // cin.tie(NULL);
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    long long C;
    scanf("%lld",&C);
    long long D;
    scanf("%lld",&D);
    long long E;
    scanf("%lld",&E);
    long long F;
    scanf("%lld",&F);
    solve(A, B, C, D, E, F);
    return 0;
}

Submission Info

Submission Time
Task C - Sugar Water
User nemupm
Language C++ (GCC 9.2.1)
Score 0
Code Size 2047 Byte
Status WA
Exec Time 24 ms
Memory 4828 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:52:10: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   52 |     scanf("%lld",&A);
      |     ~~~~~^~~~~~~~~~~
./Main.cpp:54:10: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   54 |     scanf("%lld",&B);
      |     ~~~~~^~~~~~~~~~~
./Main.cpp:56:10: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   56 |     scanf("%lld",&C);
      |     ~~~~~^~~~~~~~~~~
./Main.cpp:58:10: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   58 |     scanf("%lld",&D);
      |     ~~~~~^~~~~~~~~~~
./Main.cpp:60:10: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   60 |     scanf("%lld",&E);
      |     ~~~~~^~~~~~~~~~~
./Main.cpp:62:10: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   62 |     scanf("%lld",&F);
      |     ~~~~~^~~~~~~~~~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 3
AC × 11
WA × 1
Set Name Test Cases
Sample subtask0_0.txt, subtask0_1.txt, subtask0_2.txt
All 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, subtask0_0.txt, subtask0_1.txt, subtask0_2.txt
Case Name Status Exec Time Memory
01.txt WA 9 ms 3784 KB
02.txt AC 16 ms 4744 KB
03.txt AC 10 ms 4108 KB
04.txt AC 19 ms 4828 KB
05.txt AC 15 ms 4568 KB
06.txt AC 20 ms 4572 KB
07.txt AC 9 ms 3984 KB
08.txt AC 24 ms 4560 KB
09.txt AC 5 ms 3796 KB
subtask0_0.txt AC 4 ms 3652 KB
subtask0_1.txt AC 8 ms 3724 KB
subtask0_2.txt AC 23 ms 4572 KB