Submission #947809

# Submission time Handle Problem Language Result Execution time Memory
947809 2024-03-17T04:16:08 Z biank A Plus B (IOI23_aplusb) C++17
0 / 100
0 ms 348 KB
#include <bits/stdc++.h>
#include "aplusb.h"

using namespace std;

#define sz(x) int(x.size())

using ii = pair<int, int>;
using vi = vector<int>;

vi smallest_sums(int n, vi a, vi b) {
    priority_queue<pair<int, ii>, vector<pair<int, ii>>, greater<pair<int, ii>>> pq;
    set<ii> vis;
    auto push = [&](int i, int j) {
        pq.emplace(a[i] + b[j], ii{i, j});
        vis.emplace(i, j);
    };
    push(0, 0);
    vi ans;
    while (sz(ans) < n) {
        auto [sum, pos] = pq.top();
        ans.push_back(sum);
        pq.pop();
        auto [i, j] = pos;
        if (i + 1 < n && !vis.count({i + 1, j})) {
            push(i + 1, j);
        }
        if (j + 1 < n && !vis.count({i, j + 1})) {
            push(i, j + 1);
        }
    }
	return {};
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB 1st lines differ - expected: 1 tokens, found 0 tokens
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB 1st lines differ - expected: 1 tokens, found 0 tokens
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB 1st lines differ - expected: 1 tokens, found 0 tokens
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB 1st lines differ - expected: 1 tokens, found 0 tokens
2 Halted 0 ms 0 KB -