Submission #883739

# Submission time Handle Problem Language Result Execution time Memory
883739 2023-12-05T23:14:31 Z MattTheNub A Plus B (IOI23_aplusb) C++17
10 / 100
0 ms 348 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 int2 = pair<int, int>;

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[i] + B[ptr[p]], p});
    }
  }

  return ans;
}
# 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 344 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 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Incorrect 0 ms 348 KB 1st lines differ - on the 3rd token, expected: '2', found: '30'
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 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Incorrect 0 ms 348 KB 1st lines differ - on the 3rd token, expected: '2', found: '30'
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 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Incorrect 0 ms 348 KB 1st lines differ - on the 3rd token, expected: '2', found: '30'
8 Halted 0 ms 0 KB -