답안 #950458

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
950458 2024-03-20T10:25:54 Z ALTAKEXE Jelly Flavours (IOI20_jelly) C++14
0 / 100
34 ms 604 KB
#include <bits/stdc++.h>
#define ll long long int
#define f first
#define s second
#define pii pair<ll, ll>
using namespace std;
int find_maximum_unique(int x, int y, vector<int> a, vector<int> b)
{
    ll n = a.size(), i;
    vector<pii> v(n);
    for (ll i = 0; i < n; i++)
        v.push_back({a[i], b[i]});
    sort(v.begin(), v.end());
    vector<ll> dp;
    vector<ll> d(x + 1, 0);
    for (ll i = 0; i < n; i++)
    {
        ll ok = 0;
        dp = vector<ll>(x + 1, INT_MAX);
        for (ll j = 0; j <= x; j++)
        {
            dp[j] = d[j] + v[i].s;
            if (j - v[i].f >= 0)
                dp[j] = min(dp[j], d[j - v[i].f]);
            if (dp[j] <= y)
                ok |= 1;
        }
        if (!ok)
            break;
        swap(dp, d);
    }
    return i;
}

Compilation message

jelly.cpp: In function 'int find_maximum_unique(int, int, std::vector<int>, std::vector<int>)':
jelly.cpp:32:12: warning: 'i' may be used uninitialized in this function [-Wmaybe-uninitialized]
   32 |     return i;
      |            ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB 1st lines differ - on the 1st token, expected: '8', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB 1st lines differ - on the 1st token, expected: '8', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 504 KB 1st lines differ - on the 1st token, expected: '689', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 30 ms 604 KB 1st lines differ - on the 1st token, expected: '62', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 34 ms 604 KB 1st lines differ - on the 1st token, expected: '154', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB 1st lines differ - on the 1st token, expected: '8', found: '0'
2 Halted 0 ms 0 KB -