QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#114761 | #5314. Zombie's Treasure Chest | PetroTarnavskyi# | WA | 1ms | 3668kb | C++17 | 1.0kb | 2023-06-23 15:22:03 | 2023-06-23 15:22:06 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define FOR(i, a, b) for (int i = (a); i<(b); ++i)
#define RFOR(i, b, a) for (int i = (b)-1; i>=(a); --i)
#define MP make_pair
#define PB push_back
#define F first
#define S second
typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
const int MAGIC = 4;
int main()
{
//ios::sync_with_stdio(false);
//cin.tie(0);
int tc;
scanf("%d", &tc);
FOR(t, 1, tc + 1) {
int n, s1, v1, s2, v2;
scanf("%d%d%d%d%d", &n, &s1, &v1, &s2, &v2);
LL ans = 0;
FOR(it, 0, 2) {
FOR(x, 0, MAGIC) {
if ((LL)s1 * x > n) {
break;
}
int y = (n - s1 * x) / s2;
ans = max(ans, (LL)v1 * x + (LL)v2 * y);
}
int xMx = n / s1;
FOR(x, max(0, xMx - MAGIC), xMx + 1) {
int y = (n - s1 * x) / s2;
ans = max(ans, (LL)v1 * x + (LL)v2 * y);
}
swap(s1, s2);
swap(v1, v2);
}
printf("Case #%d: %lld\n", t, ans);
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3668kb
input:
200 2147483647 1 2147483647 2147483647 1 1000000000 30000 30000000 20000 19999999 999999999 10000 2147483647 9999 2137483647 999999999 100000 2147483647 99998 2137483647 2000000000 12345 54321 54321 200000 1000000 10000007 9 1 1 1 2 2 2 2 9 9 8 9 10 1000000005 876 875 567 566 2000000000 10000001 100...
output:
Case #1: 4611686014132420609 Case #2: 999999999998 Case #3: 214748354700000 Case #4: 21474826470000 Case #5: 8800436568 Case #6: 1000000 Case #7: 0 Case #8: 10 Case #9: 998858257 Case #10: 199003333267 Case #11: 2666666666 Case #12: 2666666664 Case #13: 268435455010000 Case #14: 4294967288 Case #15:...
result:
wrong answer 9th lines differ - expected: 'Case #9: 998858410', found: 'Case #9: 998858257'