Submission #1882862
Source Code Expand
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cout << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
cout<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 200010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 29;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
///////////////////////////////////////////////////////////////////////////////////////////////////
int A, B, C, D, E, F;
set<int> W, S;
void solve() {
cin >> A >> B >> C >> D >> E >> F;
rep(i, 0, F / (100 * A) + 1) {
rep(j, 0, F / (100 * B) + 1) {
W.insert(i * 100 * A + j * 100 * B);
}
}
rep(i, 0, F / C + 1) {
rep(j, 0, F / D + 1) {
S.insert(-(i * C + j * D));
}
}
int anss = 0, answ = 100 * A;
for(int w : W) {
int ms = min(E * w / 100, F - w);
auto ps = S.lower_bound(-ms);
if(ps != S.end()) {
int s = -(*ps);
if(w * anss <= s * answ) {
anss = s; answ = w;
}
}
}
cout << anss + answ << " " << anss << "\n";
}
int main() {
#ifndef LOCAL
ios::sync_with_stdio(false);
cin.tie(0);
#endif
cout << fixed;
cout.precision(20);
#ifdef LOCAL
freopen("in.txt", "rt", stdin);
#endif
solve();
#ifdef LOCAL
cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
return 0;
}
Submission Info
Submission Time |
|
Task |
C - Sugar Water |
User |
omochana2 |
Language |
C++14 (GCC 5.4.1) |
Score |
300 |
Code Size |
2412 Byte |
Status |
AC |
Exec Time |
30 ms |
Memory |
512 KB |
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
300 / 300 |
Status |
|
|
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 |
1 ms |
256 KB |
02.txt |
AC |
6 ms |
384 KB |
03.txt |
AC |
1 ms |
256 KB |
04.txt |
AC |
8 ms |
512 KB |
05.txt |
AC |
2 ms |
512 KB |
06.txt |
AC |
8 ms |
512 KB |
07.txt |
AC |
2 ms |
384 KB |
08.txt |
AC |
4 ms |
512 KB |
09.txt |
AC |
2 ms |
384 KB |
subtask0_0.txt |
AC |
1 ms |
256 KB |
subtask0_1.txt |
AC |
30 ms |
384 KB |
subtask0_2.txt |
AC |
2 ms |
384 KB |