QOJ.ac
QOJ
The 2nd Universal Cup Finals is coming! Check out our event page, schedule, and competition rules!
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#725727 | #2372. Level Up | LaVuna47# | Compile Error | / | / | C++20 | 1.8kb | 2024-11-08 19:37:46 | 2024-11-08 19:37:46 |
Judging History
This is the latest submission verdict.
- [2024-11-08 19:37:46]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2024-11-08 19:37:46]
- Submitted
answer
#include <bits/stdc++.h>
using namespace std;
#define sz(x) (x).size()
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define x first
#define y second
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (a) - 1; i >= (b); i--)
typedef long long ll;
typedef double db;
typedef long double LD;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<db, db> pdd;
const ll INF = 1e15;
struct Type
{
int ex1, t1, ex2, t2;
};
vector<Type> a;
int n;
ll dp[505][505][2];
ll f(int p, ll S1, ll S2, int lvl)
{
if(lvl == 1 && S2 <= 0)
{
return 0;
}
if(p == n)
return INF;
ll res = INF;
res = min(res, a[p].t2 + f(p+1, S1, S2 - a[p].ex2, lvl));
res = min(res, f(p+1, S1, S2, lvl));
if(lvl == 0)
{47
if(S1 - a[p].ex1 <= 0)
{
cout << "<=> " << S1 << " " << S2 << '\n';
res = min(res, a[p].t1 + f(p+1, 0, S2 - abs(S1 - a[p].ex1), 1));
}
else
res = min(res, a[p].t1 + f(p+1, S1 - a[p].ex1, S2, lvl));
}
return res;
}
int solve()
{
ll S1, S2;
if (!(cin >> n >> S1 >> S2))
return 1;
a = vector<Type>(n);
for(auto&[ex1, t1, ex2, t2]: a)
cin >> ex1 >> t1 >> ex2 >> t2;
sort(all(a), [](const Type& t1, const Type& t2) -> bool {
return t1.ex1 > t2.ex2;
});
ll res = f(0,S1,S2,0);
if(res == INF)
cout << "-1" << '\n';
else
cout << res << '\n';
return 0;
}
int32_t main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int TET = 1e9;
//cin >> TET;
for (int i = 1; i <= TET; i++)
{
if (solve())
{
break;
}
#ifdef ONPC
cerr << "____________________________\n";
#endif
}
#ifdef ONPC
cerr << "\nfinished in " << clock() * 1.0 / CLOCKS_PER_SEC << " sec\n";
#endif
}
Details
answer.code: In function ‘ll f(int, ll, ll, int)’: answer.code:45:12: error: expected ‘;’ before ‘if’ 45 | {47 | ^ | ; 46 | if(S1 - a[p].ex1 <= 0) | ~~ answer.code:51:17: error: expected ‘}’ before ‘else’ 51 | else | ^~~~ answer.code:45:9: note: to match this ‘{’ 45 | {47 | ^ answer.code: At global scope: answer.code:55:9: error: expected unqualified-id before ‘return’ 55 | return res; | ^~~~~~ answer.code:56:1: error: expected declaration before ‘}’ token 56 | } | ^ answer.code: In function ‘ll f(int, ll, ll, int)’: answer.code:53:9: warning: control reaches end of non-void function [-Wreturn-type] 53 | } | ^