답안 #883742

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
883742 2023-12-05T23:17:03 Z MattTheNub A Plus B (IOI23_aplusb) C++17
100 / 100
48 ms 5936 KB
#include <bits/stdc++.h>
using namespace std;

template <class T> using v = vector<T>;
#ifdef EVAL
#define dbg(...)
#define dbg2d(...)
#else
istream &__cin = cin;
#include "../../debug.h"
__cinwrapper __cin_wrapper;
#include "../../debug.cpp"
#endif

#include "aplusb.h"

using ll = long long;
using int2 = pair<int, int>;
using ll2 = pair<ll, ll>;

std::vector<int> smallest_sums(int N, std::vector<int> A, std::vector<int> B) {
  v<int> ptr(N);

  priority_queue<int2, v<int2>, greater<int2>> vals;
  for (int i = 0; i < N; i++) {
    vals.push({A[i] + B[0], i});
  }
  v<int> ans;
  for (int i = 0; i < N; i++) {
    auto [v, p] = vals.top();
    vals.pop();

    ans.push_back(v);

    if (++ptr[p] < N) {
      vals.push({A[p] + B[ptr[p]], p});
    }
  }

  return ans;
}
# 결과 실행 시간 메모리 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 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 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 436 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 348 KB Output is correct
19 Correct 0 ms 432 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 1 ms 600 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 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 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 436 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 348 KB Output is correct
19 Correct 0 ms 432 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 1 ms 600 KB Output is correct
22 Correct 1 ms 604 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 1 ms 344 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 1 ms 448 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 1 ms 344 KB Output is correct
31 Correct 1 ms 344 KB Output is correct
32 Correct 1 ms 448 KB Output is correct
33 Correct 1 ms 576 KB Output is correct
34 Correct 1 ms 604 KB Output is correct
35 Correct 1 ms 348 KB Output is correct
36 Correct 1 ms 448 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 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 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 436 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 348 KB Output is correct
19 Correct 0 ms 432 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 1 ms 600 KB Output is correct
22 Correct 1 ms 604 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 1 ms 344 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 1 ms 448 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 1 ms 344 KB Output is correct
31 Correct 1 ms 344 KB Output is correct
32 Correct 1 ms 448 KB Output is correct
33 Correct 1 ms 576 KB Output is correct
34 Correct 1 ms 604 KB Output is correct
35 Correct 1 ms 348 KB Output is correct
36 Correct 1 ms 448 KB Output is correct
37 Correct 7 ms 1748 KB Output is correct
38 Correct 24 ms 4560 KB Output is correct
39 Correct 26 ms 4468 KB Output is correct
40 Correct 25 ms 4580 KB Output is correct
41 Correct 34 ms 5936 KB Output is correct
42 Correct 34 ms 5840 KB Output is correct
43 Correct 31 ms 5328 KB Output is correct
44 Correct 7 ms 1496 KB Output is correct
45 Correct 25 ms 4548 KB Output is correct
46 Correct 25 ms 4560 KB Output is correct
47 Correct 25 ms 4552 KB Output is correct
48 Correct 45 ms 5832 KB Output is correct
49 Correct 35 ms 5808 KB Output is correct
50 Correct 33 ms 5320 KB Output is correct
51 Correct 48 ms 5148 KB Output is correct
52 Correct 42 ms 5320 KB Output is correct
53 Correct 38 ms 5056 KB Output is correct