답안 #933363

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
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;
}

# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 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 -