| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 1080068 | serifefedartar | Akcija (COCI21_akcija) | C++17 | 5008 ms | 24584 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(0);cin.tie(0)
typedef long long ll;
#define f first
#define s second
#define LOGN 21
const ll MOD = 1e9 + 7;
const ll MAXN = 150;
#define int long long
vector<pair<int,int>> v;
vector<set<int>> dp;
signed main() {
    fast;
    int n, k;
    cin >> n >> k;
    v = vector<pair<int,int>>(n);
    for (int i = 0; i < n; i++)
        cin >> v[i].s >> v[i].f;
    sort(v.begin(), v.end());
    dp = vector<set<int>>(n+1, set<int>());
    dp[0].insert(0);
    for (auto u : v) {
        for (int i = n; i >= 0; i--) {
            if (i+1 > u.f)
                continue;
            for (auto Q : dp[i]) {
                dp[i + 1].insert(Q + u.s);
                if (dp[i+1].size() > k)
                    dp[i+1].erase(prev(dp[i+1].end()));
            }
        }
    }
    for (int i = n; k && i >= 0; i--) {
        while (k && dp[i].size()) {
            cout << i << " " << *(dp[i].begin()) << "\n";
            k--;
            dp[i].erase(dp[i].begin());
        }
    }
}
컴파일 시 표준 에러 (stderr) 메시지
| # | 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... | ||||
