Submission #19424129


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;
    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 (answer == pair<int, int>{0, 0} || answer.second * i < j * answer.first) {
            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 300
Code Size 2039 Byte
Status AC
Exec Time 27 ms
Memory 4828 KB

Compile Error

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

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 12
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 AC 11 ms 3780 KB
02.txt AC 27 ms 4716 KB
03.txt AC 12 ms 4164 KB
04.txt AC 20 ms 4828 KB
05.txt AC 20 ms 4500 KB
06.txt AC 21 ms 4484 KB
07.txt AC 12 ms 3992 KB
08.txt AC 24 ms 4592 KB
09.txt AC 8 ms 3736 KB
subtask0_0.txt AC 2 ms 3616 KB
subtask0_1.txt AC 6 ms 3864 KB
subtask0_2.txt AC 19 ms 4748 KB