Submission #933363

# Submission time Handle Problem Language Result Execution time Memory
933363 2024-02-25T14:57:03 Z sleepntsheep A Plus B (IOI23_aplusb) C++17
10 / 100
1 ms 348 KB
#include "aplusb.h"
#include <set>
#include <tuple>
#include <map>
#include <utility>
#include <queue>

std::vector<int> smallest_sums(int n, std::vector<int> a, std::vector<int> b)
{
    std::vector<int> c(n);

    std::priority_queue<std::tuple<int, int, int>> q;
    q.emplace(-a[0] + -b[0], 0, 0);
    std::set<std::tuple<int, int>> ss;
    for (int k=0;k<n;++k)
    {
        auto [aa,i,j]=q.top();q.pop();
        if (ss.count({i, j})) continue;
        ss.insert({i, j});
        c[k]=-aa;
        if(i+1<n) q.emplace(-a[i+1]+-b[j],i+1,j);
        if(j+1<n) q.emplace(-a[i]+-b[j+1],i,j+1);
    }

	return c;
}

# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Incorrect 1 ms 348 KB 1st lines differ - on the 6th token, expected: '32', found: '0'
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Incorrect 1 ms 348 KB 1st lines differ - on the 6th token, expected: '32', found: '0'
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Incorrect 1 ms 348 KB 1st lines differ - on the 6th token, expected: '32', found: '0'
8 Halted 0 ms 0 KB -