답안 #933364

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
933364 2024-02-25T14:57:20 Z sleepntsheep A Plus B (IOI23_aplusb) C++17
100 / 100
82 ms 10332 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;)
    {
        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);
        ++k;
    }

	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 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 424 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 428 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 428 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 344 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 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 424 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 428 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 428 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 344 KB Output is correct
22 Correct 0 ms 344 KB Output is correct
23 Correct 1 ms 344 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 2 ms 604 KB Output is correct
27 Correct 1 ms 604 KB Output is correct
28 Correct 1 ms 604 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 1 ms 404 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 2 ms 432 KB Output is correct
34 Correct 2 ms 604 KB Output is correct
35 Correct 1 ms 604 KB Output is correct
36 Correct 2 ms 604 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 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 424 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 428 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 428 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 344 KB Output is correct
22 Correct 0 ms 344 KB Output is correct
23 Correct 1 ms 344 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 2 ms 604 KB Output is correct
27 Correct 1 ms 604 KB Output is correct
28 Correct 1 ms 604 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 1 ms 404 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 2 ms 432 KB Output is correct
34 Correct 2 ms 604 KB Output is correct
35 Correct 1 ms 604 KB Output is correct
36 Correct 2 ms 604 KB Output is correct
37 Correct 10 ms 2136 KB Output is correct
38 Correct 43 ms 8060 KB Output is correct
39 Correct 44 ms 7184 KB Output is correct
40 Correct 45 ms 7180 KB Output is correct
41 Correct 71 ms 9568 KB Output is correct
42 Correct 63 ms 9224 KB Output is correct
43 Correct 56 ms 9476 KB Output is correct
44 Correct 11 ms 2256 KB Output is correct
45 Correct 47 ms 7052 KB Output is correct
46 Correct 51 ms 6924 KB Output is correct
47 Correct 48 ms 7080 KB Output is correct
48 Correct 62 ms 9480 KB Output is correct
49 Correct 57 ms 10332 KB Output is correct
50 Correct 57 ms 9472 KB Output is correct
51 Correct 79 ms 8236 KB Output is correct
52 Correct 82 ms 8128 KB Output is correct
53 Correct 80 ms 8012 KB Output is correct