이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
#define FOR(i, a, b)  for(int i = (a), _b = (b); i <= _b; ++i)
#define FORD(i, b, a) for(int i = (b), _a = (a); i >= _a; --i)
#define REP(i, a, b)  for(int i = (a), _b = (b); i < _b;  ++i)
#define REPD(i, b, a) for(int i = (b), _a = (a); i > _a;  --i)
#define MASK(i) (1LL << (i))
#define BIT(mask, i) (((mask) >> (i)) & 1)
#define __builtin_popcount __builtin_popcountll
#define all(val) val.begin(), val.end()
#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define sz(v) (int)v.size()
#define fi first
#define se second
mt19937_64 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
ll Rand(ll l, ll r) {return l + rng() % (r - l + 1);}
template<class X, class Y>
    bool minimize(X &x, const Y &y) {
        if (x > y) {
            x = y;
            return true;
        } else return false;
    }
template<class X, class Y>
    bool maximize(X &x, const Y &y) {
        if (x < y) {
            x = y;
            return true;
        } else return false;
    }
template<class T>
    T Abs(const T &x) {
        return (x < 0 ? -x : x);    
    }
const int mod = 1e9 + 7;
const int inf = 1e9;
const int N = 2e3 + 5;
const int maxn = 1e4 + 5;
int pre[N][maxn], suf[N][maxn];
#include "jelly.h"
int find_maximum_unique(int x, int y, vector<int> a, vector<int> b) {
    int n = a.size();
    vector<pii> v;
    REP(i, 0, n) v.emplace_back(a[i], b[i]);
    sort(all(v));
    REP(i, 0, n) FOR(j, 0, x) {
        pre[i + 1][j] = pre[i][j] + v[i].se;
        if(j >= v[i].fi) 
            minimize(pre[i + 1][j], pre[i][j - v[i].fi]);
    }
    FORD(i, n - 1, 0) FOR(j, 0, y) {
        suf[i + 1][j] = suf[i + 2][j];
        if(j >= v[i].se)
            maximize(suf[i + 1][j], suf[i + 2][j - v[i].se] + 1);
    }
    int res = 0;
    FOR(i, 0, n) if(pre[i][x] <= y) {
        maximize(res, i + suf[i + 1][y - pre[i][x]]);
    }
    return res;
}
// void process() {
//     int n, x, y; cin >> n >> x >> y;
//     vector<int> a(n), b(n);
//     for(int &val : a) cin >> val;
//     for(int &val : b) cin >> val;
//     cout << find_maximum_unique(x, y, a, b);
// }
// signed main() {
//     if(fopen("test.inp","r")) {
//         freopen("test.inp","r",stdin);
//         freopen("test.out","w",stdout);
//     }
//     ios::sync_with_stdio(0);
//     cin.tie(0); cout.tie(0);
//     // clock_t start = clock();
//     int ntests = 1;
//     // cin >> ntests;
//     while(ntests--) process();
//     // cerr << "Time elapsed: " << clock() - start << " ms!\n";
//     return 0;
// }
// https://oj.uz/problem/view/IOI20_jelly
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... |