Submission #73589122


Source Code Expand

#include <bits/stdc++.h>
#include <iterator>
using namespace std;
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
#else
struct AtCoderError {
  AtCoderError() {
    std::cerr << "This machine isn't installed ACL." << std::endl;
  }
};
AtCoderError __ATCODER_ERROR();
#endif

#ifndef ONLINE_JUDGE
#define NDEBUG
#define _GLIBCXX_DEBUG
struct IOSetting {
  IOSetting() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(20) << fixed;
  }
};
IOSetting __IOSetting();
#endif

#define int long long
#define double long double
#define all(a) (a).begin(), (a).end()

using P = pair<int, int>;

const double PI = acos(-1.0L);
constexpr int BMOD = 1000000007;
constexpr int SMOD = 998244353;
constexpr double DINF = numeric_limits<double>::infinity();

template <typename T>
concept Addable = requires(T a, T b) {
  { a + b } -> convertible_to<T>;
};

template <typename T, typename U, typename V> struct triple {
  T first;
  U second;
  V third;
  triple() : first{}, second{}, third{} {}
  triple(T &&a, U &&b, V &&c)
      : first(forward(a)), second(forward(b)), third(forward(c)) {}
  triple(const triple &) = default;
  triple &operator=(const triple &) = default;
  triple(triple &&) = default;
  triple &operator=(triple &&) = default;
  void swap(triple &other) {
    swap(first, other.first);
    swap(second, other.second);
    swap(third, other.third);
  }
  auto getTuple() const { return tie(first, second, third); }
  bool operator<=>(const triple<T, U, V> rhs) const {
    return getTuple() <=> rhs.getTuple();
  }
  bool operator==(const triple<T, U, V> rhs) const {
    return getTuple() == rhs.getTuple();
  }
  ostream &operator<<(ostream &os) {
    os << first << ' ' << second << ' ' << third;
    return os;
  }
  istream &operator>>(istream &is) {
    is >> first >> second >> third;
    return is;
  }
};

struct Pos {
  int x, y;
  Pos() : x(0), y(0) {}
  Pos(int x, int y) : x(x), y(y) {}
  Pos(P p) : x(p.first), y(p.second) {}
  auto operator<=>(const Pos &other) const {
    return tie(x, y) <=> tie(other.x, other.y);
  }
  bool operator==(const Pos &other) const {
    return x == other.x && y == other.y;
  }
  Pos operator+() const { return *this; }
  Pos operator-() const { return Pos(-x, -y); }
  Pos operator+(const Pos &other) const {
    return Pos(x + other.x, y + other.y);
  }
  Pos operator-(const Pos &other) const {
    return Pos(x - other.x, y - other.y);
  }
  Pos operator*(int scalar) const { return Pos(x * scalar, y * scalar); }
  Pos operator/(int scalar) const { return Pos(x / scalar, y / scalar); }
  Pos &set(int nx, int ny) {
    x = nx;
    y = ny;
    return *this;
  }
  Pos &operator+=(int num) { return set(x + num, y + num); }
  Pos &operator+=(const Pos &other) { return set(x + other.x, y + other.y); }
  Pos &operator-=(int num) { return set(x - num, y - num); }
  Pos &operator-=(const Pos &other) { return set(x - other.x, y - other.y); }
  Pos &operator*=(int scalar) { return set(x * scalar, y * scalar); }
  Pos &operator/=(int scalar) { return set(x / scalar, y / scalar); }
  Pos &operator%=(int value) { return set(x % value, y % value); }
  Pos &operator++() { return set(x + 1, y + 1); }
  Pos &operator--() { return set(x - 1, y - 1); }
  Pos operator++(signed) {
    Pos old = *this;
    ++(*this);
    return old;
  }
  Pos operator--(signed) {
    Pos old = *this;
    --(*this);
    return old;
  }
  ostream &operator<<(ostream &os) {
    os << x << " " << y;
    return os;
  }
  istream &operator>>(istream &is) {
    is >> x >> y;
    return is;
  }
  int norm_sq() const { return x * x + y * y; }
  double norm() const { return sqrt((double)norm_sq()); }
  int dot(const Pos &other) const { return x * other.x + y * other.y; }
  int cross(const Pos &other) const { return x * other.y - y * other.x; }
  void rotate90() {
    int old_x = x;
    x = y;
    y = -old_x;
  }
  int manhattan_dis(const Pos &other) const {
    return abs(x - other.x) + abs(y - other.y);
  }
  int distance_sq(const Pos &other) const {
    return (x - other.x) * (x - other.x) + (y - other.y) * (y - other.y);
  }
  double distance(const Pos &other) const {
    return sqrt((double)distance_sq(other));
  }
  int distance_8(const Pos &other) const {
    return max(abs(x - other.x), abs(y - other.y));
  }
  int distance_4(const Pos &other) const { return manhattan_dis(other); }
  Pos reset() {
    x = 0;
    y = 0;
    return Pos(0, 0);
  }
  Pos reverse() {
    Pos old = Pos(x, y);
    x = old.y;
    y = old.x;
    return Pos(y, x);
  }
};

const vector<Pos> dir4 = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
const vector<Pos> dir8 = {{1, 0}, {-1, 0}, {0, 1},   {0, -1},
                          {1, 1}, {-1, 1}, {-1, -1}, {1, -1}};

template <typename T>
vector<T> operator+(const vector<T> &lhs, const vector<T> &rhs) {
  vector<T> result;
  result.reserve(lhs.size() + rhs.size());
  result.insert(result.end(), lhs.begin(), lhs.end());
  result.insert(result.end(), rhs.begin(), lhs.end());
  return result;
}

template <typename T>
vector<T> operator+(vector<T> &&lhs, const vector<T> &rhs) {
  lhs.insert(lhs.end(), rhs.begin(), rhs.end());
  return move(lhs);
}

template <typename T>
vector<T> operator+(const vector<T> &lhs, vector<T> &&rhs) {
  rhs.insert(rhs.begin(), lhs.begin(), lhs.end());
  return move(rhs);
}

template <typename T> vector<T> operator+(vector<T> &&lhs, vector<T> &&rhs) {
  lhs.insert(lhs.end(), make_move_iterator(rhs.begin()),
             make_move_iterator(rhs.end()));
  return move(lhs);
}

template <typename T> vector<T> operator*(vector<T> &&lhs, int scalar) {
  vector<T> res = {};
  while (scalar--)
    res = res + lhs;
  return res;
}
template <typename T> vector<T> operator*=(vector<T> &&lhs, int num) {
  lhs = lhs * num;
  return lhs;
}

template <typename T> bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T> bool chmin(T &a, signed b) {
  int lb = b;
  if (a > lb) {
    a = lb;
    return true;
  }
  return false;
}
template <typename T> bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T> bool chmax(T &a, signed b) {
  int lb = b;
  if (a < lb) {
    a = lb;
    return true;
  }
  return false;
}
template <class... T> constexpr auto min(T... a) {
  return min(initializer_list<common_type_t<T...>>{a...});
}
template <class... T> constexpr auto max(T... a) {
  return max(initializer_list<common_type_t<T...>>{a...});
}

template <typename T, typename U>
istream &operator>>(istream &is, pair<T, U> &p) {
  is >> p.first >> p.second;
  return is;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, pair<T, U> &p) {
  os << p.first << " " << p.second;
  return os;
}
template <typename C, typename = decltype(begin(declval<C>())),
          typename = enable_if_t<!is_same_v<C, string>>>
istream &operator>>(istream &is, C &c) {
  for (auto &e : c)
    is >> e;
  return is;
}
template <typename C, typename = decltype(begin(declval<C>())),
          typename = enable_if_t<!is_same_v<C, string>>>
ostream &operator<<(ostream &os, const C &c) {
  bool f = true;
  for (const auto &e : c)
    os << (f ? "" : " ") << e, f = false;
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<vector<T>> &v) {
  for (const auto &e : v)
    os << e << endl;
  return os;
}
constexpr int power(int a, int n, int mod = -1) {
  int res = 1;
  if (mod != -1)
    a %= mod;
  while (n > 0) {
    if (n & 1)
      res = (mod != 1) ? (res * a) % mod : res * a;
    a = (mod != -1) ? (a * a) % mod : a * a;
    n >>= 1;
  }
  return res;
}
constexpr map<int, int> prime_factorize(int N) {
  map<int, int> res;
  for (int i = 2; i * i <= N; i++) {
    while (N % i == 0) {
      res[i]++;
      N /= i;
    }
  }
  if (N != 1)
    res[N] = 1;
  return res;
}
constexpr int digit_sum(int N) {
  int res = 0;
  N = abs(N);
  while (N > 0) {
    res += N % 10;
    N /= 10;
  }
  return res;
}
constexpr bool is_palindrome(const string &s) {
  for (int i = 0; i < (int)s.size() / 2; i++)
    if (s[i] != s[s.size() - 1 - i])
      return false;
  return true;
}
template <typename T> constexpr vector<pair<T, int>> RLE(const vector<T> &s) {
  if (s.empty())
    return {};
  vector<pair<T, int>> res;
  T current = s.front();
  int count = 1;
  for (int i = 1; i < s.size(); i++) {
    if (s[i] == current)
      count++;
    else {
      res.push_back({current, count});
      current = s[i];
      count = 1;
    }
  }
  res.push_back({current, count});
  return res;
}

template <typename T> class Arr {
protected:
  vector<T> data;

public:
  Arr() = default;
  Arr(int N) : data(N) {}
  Arr(int N, T val) : data(N, val) {}
  Arr(vector<T> v) : data(std::move(v)) {}
  Arr(initializer_list<T> init) : data(init) {}

  auto begin() { return data.begin(); }
  auto end() { return data.end(); }
  auto begin() const { return data.begin(); }
  auto end() const { return data.end(); }

  size_t size() const { return data.size(); }
  bool empty() const { return data.empty(); }
  void clear() const { return data.clear(); }
  size_t capacity() const { return data.capacity(); }
  Arr &push(T val) {
    data.push_back(val);
    return *this;
  }
  Arr &pop() {
    data.pop_back();
    return *this;
  }
  Arr &insert(int idx, T val) {
    data.insert(data.begin() + normalize_idx(idx), val);
    return *this;
  }
  Arr &remove(int idx) {
    data.erase(data.begin() + normalize_idx(idx));
    return *this;
  }
  int normalize_idx(int i) const {
    if (i < 0)
      i += data.size();
    assert(i >= 0 && i < (int)data.size());
    return i;
  }
  T &operator[](int i) { return data[normalize_idx(i)]; }
  const T &operator[](int i) const { return data[normalize_idx(i)]; }
  Arr &sort() {
    std::sort(all(data));
    return *this;
  }
  template <typename Compare> Arr &sort(Compare comp) {
    std::sort(all(data), comp);
    return *this;
  }
  Arr &sort_desc() {
    std::sort(data.rbegin(), data.rend());
    return *this;
  }
  Arr &reverse() { reverse(all(data)); }
  Arr &unique() {
    data.erase(std::unique(all(data)), data.end());
    return *this;
  }
  Arr &shrink_to_ift() {
    data.shrink_to_fit();
    return *this;
  }
  void reserve(int N) { data.reserve(N); }
  T sum() const
    requires integral<T>
  {
    return accumulate(all(data), 0);
  }
  T max() const
    requires totally_ordered<T>
  {
    assert(!data.empty());
    return *max_element(all(data));
  }
  T min() const
    requires totally_ordered<T>
  {
    assert(!data.empty());
    return *min_element(all(data));
  }
  template <typename F> auto map(F f) const {
    using U = invoke_result_t<F, T>;
    Arr<U> res;
    res.reserve(data.size());
    for (const auto &x : data)
      res.push(f(x));
    return res;
  }
  template <typename F> auto filter(F f) const {
    Arr res;
    for (const auto &x : data)
      if (f(x))
        res.push(x);
    return res;
  }
  Arr<pair<T, int>> rle() const {
    if (data.empty())
      return {};
    Arr<pair<T, int>> res;
    res.push_back({data[0], 1});
    for (int i = 1; i < size(); i++) {
      if (data[i] == res[-1].first)
        res.back().second++;
      else
        res.push({data[i], 1});
    }
    return res;
  }
  static Arr iota(int N, T start = 0) {
    Arr res(N);
    iota(res.begin(), res.end(), start);
    return res;
  }
  template <typename F> bool all_of(F f) {
    bool flag = true;
    for (auto &i : data)
      if (!f(i)) {
        flag = false;
        break;
      }
    return flag;
  }
  template <typename F> bool any_of(F f) {
    for (auto &i : data)
      if (f(i))
        return true;
    return false;
  }
  template <typename F> int count_if(F f) {
    int res = 0;
    for (auto &i : data)
      res += f(i);
    return res;
  }

  bool is_arithmetic() {
    if (size() < 2)
      return true;
    int diff = data[1] - data[0];
    for (int i = 2; i < size(); i++)
      if (data[i] - data[i - 1] != diff)
        return false;
    return true;
  }
  bool is_geometric() {
    if (size() < 3)
      return true;
    for (int i = 0; i < size() - 2; i++)
      if (data[i] * data[i + 2] != data[i + 1] * data[i + 1])
        return false;
    return true;
  }
  virtual ~Arr() = default;
};
class CumulativeArr : public Arr<int> {
public:
  using Arr<int>::data;
  using Arr<int>::normalize_idx;
  int sum() const { return this->data.back(); }
  CumulativeArr(const vector<int> &v) {
    data.assign(v.size() + 1, 0);
    for (int i = 0; i < (int)v.size(); i++) {
      data[i + 1] = data[i] + v[i];
    }
  }
  CumulativeArr(const Arr<int> &v) {
    data.assign(v.size() + 1, 0);
    for (int i = 0; i < (int)v.size(); i++) {
      data[i + 1] = data[i] + v[i];
    }
  }
  int sum(int l, int r) const {
    l = normalize_idx(l);
    r = normalize_idx(r);
    if (l >= r)
      return 0;
    return data[r] - data[l];
  }
  int lower_bound(int val) const {
    return distance(data.begin(), std::lower_bound(all(data), val));
  }
  int upper_bound(int val) const {
    return distance(data.begin(), std::upper_bound(all(data), val));
  }
};
template <typename T> class BinaryArr : public Arr<T> {
public:
  using Arr<T>::data;
  using Arr<T>::normalize_idx;
  BinaryArr(vector<T> v, bool need_sort = true) : Arr<T>(move(v)) {
    if (need_sort)
      sort(all(data));
  }
  BinaryArr(Arr<T> v, bool need_sort = true) : Arr<T>(move(v)) {
    if (need_sort)
      v.sort();
  }
  int lower_bound(T val) const {
    return distance(data.begin(), std::lower_bound(all(data), val));
  }
  int upper_bound(T val) const {
    return distance(data.begin(), std::upper_bound(all(data), val));
  }
  int count(T val) const { return upper_bound(val) - lower_bound(val); }
  bool exists(T val) const {
    int idx = lower_bound(val);
    return idx < data.size() && data[idx] == val;
  }
};

template <typename T> class Grid {
public:
  int h, w;
  T default_value;
  Arr<T> data;

  // 基本コンストラクタ
  Grid(int h, int w, T default_value = T())
      : h(h), w(w), data(h * w, default_value), default_value(default_value) {}

  // char型限定: vector<string> からの変換
  template <typename U = T>
  typename std::enable_if<std::is_same<U, char>::value, void>::
      type static from_strings(const std::vector<std::string> &s) {
    int H = s.size();
    int W = s[0].size();
    Grid<char> g(H, W);
    for (int i = 0; i < H; i++)
      for (int j = 0; j < W; j++)
        g[i, j] = s[i][j];
    return g;
  }

  // インデックス管理
  inline int to_idx(int y, int x) const { return y * w + x; }
  inline int to_idx(Pos p) const { return p.y * w + p.x; }
  inline Pos to_pos(int idx) const { return {idx / w, idx % w}; }

  // アクセス
  T &operator[](int y, int x) { return data[to_idx(y, x)]; }
  const T &operator[](int y, int x) const { return data[to_idx(y, x)]; }
  T &operator[](Pos p) { return data[to_idx(p)]; }
  const T &operator[](Pos p) const { return data[to_idx(p)]; }

  // 比較
  bool operator==(const Grid &other) const {
    return (h == other.h) && (w == other.w) && (data == other.data);
  }

  int area() { return h * w; }
  void reset() {
    for (auto &i : data)
      for (auto &j : i)
        j = default_value;
  }

  Grid fill_row(int R, T value) {
    Grid res(data);
    for (int i = 0; i < w; i++)
      res[to_idx(R, i)] = value;
    return res;
  }
  Grid fill_col(int C, T value) {
    Grid res(data);
    for (int i = 0; i < h; i++)
      res[to_idx(i, C)] = value;
    return res;
  }
  int count_row(int R, T value) const {
    int res = 0;
    for (int j = 0; j < w; j++)
      res += data[to_idx(R, j)] == value;
    return res;
  }
  vector<int> count_every_row(T value) const {
    vector<int> res(h, 0);
    for (int i = 0; i < h; i++)
      res[i] = count_row(i, value);
    return res;
  }
  int count_col(int C, T value) const {
    int res = 0;
    for (int i = 0; i < h; i++)
      res += data[to_idx(i, C)] == value;
    return res;
  }
  vector<int> count_every_col(T value) const {
    vector<int> res(w, 0);
    for (int j = 0; j < w; j++)
      res[j] = count_col(j, value);
    return res;
  }
  int count_all(T value) const {
    int res = 0;
    for (auto &i : data)
      for (auto &j : data)
        res += j == value;
    return res;
  }
  bool contains(T value) const { return count_all(value); }
  bool contains(const Grid &pattern) const {
    if (pattern.h > h || pattern.w > w)
      return false;
    for (int i = 0; i <= h - pattern.h; i++) {
      for (int j = 0; j <= w - pattern.w; j++) {
        bool match = true;
        for (int k = 0; k < pattern.h; k++) {
          for (int l = 0; l < pattern.w; l++) {
            if (data[to_idx(l + k, j + l)] != pattern[pattern.to_idx(k, l)]) {
              match = false;
              break;
            }
          }
          if (!match)
            break;
        }
        if (match)
          return true;
      }
    }
    return false;
  }
  template <typename Func> void foreach (Func func) {
    for (auto &i : data)
      for (auto &j : i)
        func(j);
  }
  template <typename Func> void foreach_row(int r, Func func) {
    if (r < 0 || r >= h)
      return;
    for (int j = 0; j < w; j++)
      func(data[to_idx(r, j)]);
  }
  template <typename Func> void foreach_col(int c, Func func) {
    if (c < 0 || c >= w)
      return;
    for (int i = 0; i < h; i++)
      func(data[to_idx(i, c)]);
  }

  bool in_scope(int y, int x) const {
    return 0 <= y && y < h && 0 <= x && x < w;
  }
  bool in_scope(Pos p) const { return in_scope(p.y, p.x); }

  // 90度時計回りに回転
  Grid rotate90() const {
    Grid res(w, h);
    for (int y = 0; y < h; y++) {
      for (int x = 0; x < w; x++) {
        res(x, h - 1 - y) = (*this)(y, x);
      }
    }
    return res;
  }

  // 部分グリッドの切り出し [p1, p2)
  Grid subgrid(Pos p1, Pos p2) const {
    int new_h = p2.y - p1.y;
    int new_w = p2.x - p1.x;
    Grid res(new_h, new_w);
    for (int y = 0; y < new_h; y++) {
      for (int x = 0; x < new_w; x++) {
        if (in_scope(p1.y + y, p1.x + x))
          res(y, x) = (*this)(p1.y + y, p1.x + x);
      }
    }
    return res;
  }

  std::vector<Pos> neighbors4(Pos p) const {
    std::vector<Pos> res;
    for (auto &dp : dir4) {
      Pos next = p + dp;
      if (in_scope(next))
        res.push_back(next);
    }
    return res;
  }
  std::vector<Pos> neighbors8(Pos p) const {
    std::vector<Pos> res;
    for (auto &dp : dir8) {
      Pos next = p + dp;
      if (in_scope(next))
        res.push_back(next);
    }
    return res;
  }

  Pos find(T val) const {
    for (int i = 0; i < data.size(); i++)
      if (data[i] == val)
        return to_pos(i);
  }

  std::vector<Pos> find_all(T val) const {
    std::vector<Pos> res;
    for (int i = 0; i < data.size(); i++) {
      if (data[i] == val)
        res.push_back(to_pos(i));
    }
    return res;
  }

  // BFSによる最短距離 (数値グリッドを返す)
  Grid<int> bfs(Pos start, std::optional<T> wall = std::nullopt) const {
    Grid<int> dists(h, w, -1);
    std::queue<Pos> que;
    dists[start] = 0;
    que.push(start);
    while (!que.empty()) {
      Pos cur = que.front();
      que.pop();
      for (auto next : neighbors4(cur)) {
        if (wall && (*this)(next) == *wall)
          continue;
        if (dists[next] == -1) {
          dists[next] = dists[cur] + 1;
          que.push(next);
        }
      }
    }
    return dists;
  }

  // 2次元累積和用の内部データ
  std::vector<T> sum_data;
  bool sum_built = false;

  template <typename U = T>
  typename std::enable_if<std::is_arithmetic<U>::value, void>::type
  build_cumulative_sum() {
    sum_data.assign((h + 1) * (w + 1), 0);
    for (int y = 0; y < h; y++) {
      for (int x = 0; x < w; x++) {
        sum_data[(y + 1) * (w + 1) + (x + 1)] =
            (*this)(y, x) + sum_data[y * (w + 1) + (x + 1)] +
            sum_data[(y + 1) * (w + 1) + x] - sum_data[y * (w + 1) + x];
      }
    }
    sum_built = true;
  }

  // 半開区間 [p1, p2) の合計を求める
  template <typename U = T>
  typename std::enable_if<std::is_arithmetic<U>::value, U>::type
  query_sum(Pos p1, Pos p2) const {
    assert(sum_built);
    return sum_data[p2.y * (w + 1) + p2.x] - sum_data[p1.y * (w + 1) + p2.x] -
           sum_data[p2.y * (w + 1) + p1.x] + sum_data[p1.y * (w + 1) + p1.x];
  }

  void show() const {
    for (int y = 0; y < h; y++) {
      for (int x = 0; x < w; x++) {
        std::cerr << (*this)(y, x) << (x == w - 1 ? "" : " ");
      }
      std::cerr << std::endl;
    }
  }

  istream &operator>>(istream &is) {
    is >> data;
    return is;
  }
  ostream &operator<<(ostream &os) {
    os << data;
    return data;
  }
};

template <class S, S (*op)(S, S), S (*e)(), typename T = int>
struct CompressSegtree {
private:
  Arr<T> coords;
  segtree<S, op, e> seg;
  bool built = false;

public:
  CompressSegtree() = default;
  void add_point(T x) {
    assert(!built);
    coords.push(x);
  }
  void build() {
    coords.sort().unique();
    seg = segtree<S, op, e>(coords.size());
    built = true;
  }
  void set(T x, S val) {
    assert(built);
    int idx = coords.lower_bound(x);
    if (idx < coords.size() && coords[idx] == x) {
      seg.set(idx, val);
    }
  }
  S get(T x) const {
    assert(built);
    int idx = coords.lower_bound(x);
    if (idx < coords.size() && coords[idx] == x) {
      return seg.get(idx);
    }
    return e();
  }
  S prod(T lx, T rx) const {
    assert(built);
    int l = coords.lower_bound(lx);
    int r = coords.lower_bound(rx);
    return seg.prod(l, r);
  }
  size_t size() const { return coords.size(); }
};

signed main() {
  int N, K, M;
  cin >> N >> K >> M;
  vector<P> H(N);
  cin >> H;
  vector<int> be, ex;
  for (int i = 0; i < H.size(); i++) {
    if (H[i].first == 1)
      ex.push_back(H[i].second);
    else
      be.push_back(H[i].second);
  }
  if (ex.size() < M || be.size() < (K - M)) {
    cout << -1 << endl;
    return 0;
  }
  sort(ex.rbegin(), ex.rend());
  sort(be.rbegin(), be.rend());
  int ans = 0;
  for (int i = 0; i < M; i++) {
    ans += ex[i];
  }
  for (int i = 0; i < (K - M); i++) {
    ans += be[i];
  }
  cout << ans << endl;

  // main
  return 0;
}

Submission Info

Submission Time
Task C - Team Formation
User kousa__
Language C++23 (GCC 15.2.0)
Score 300
Code Size 23159 Byte
Status AC
Exec Time 80 ms
Memory 9292 KiB

Compile Error

./Main.cpp: In function 'int main()':
./Main.cpp:856:21: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  856 |   for (int i = 0; i < H.size(); i++) {
      |                   ~~^~~~~~~~~~
./Main.cpp:862:17: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
  862 |   if (ex.size() < M || be.size() < (K - M)) {
      |       ~~~~~~~~~~^~~
./Main.cpp:862:34: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
  862 |   if (ex.size() < M || be.size() < (K - M)) {
      |                        ~~~~~~~~~~^~~~~~~~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 87
Set Name Test Cases
Sample sample01.txt, sample02.txt, sample03.txt
All sample01.txt, sample02.txt, sample03.txt, in01.txt, in02.txt, in03.txt, in04.txt, in05.txt, in06.txt, in07.txt, in08.txt, in09.txt, in10.txt, in11.txt, in12.txt, in13.txt, in14.txt, in15.txt, in16.txt, in17.txt, in18.txt, in19.txt, in20.txt, in21.txt, in22.txt, in23.txt, in24.txt, in25.txt, in26.txt, in27.txt, in28.txt, in29.txt, in30.txt, in31.txt, in32.txt, in33.txt, in34.txt, in35.txt, in36.txt, in37.txt, in38.txt, in39.txt, in40.txt, in41.txt, in42.txt, in43.txt, in44.txt, in45.txt, in46.txt, in47.txt, in48.txt, in49.txt, in50.txt, in51.txt, in52.txt, in53.txt, in54.txt, in55.txt, in56.txt, in57.txt, in58.txt, in59.txt, in60.txt, in61.txt, in62.txt, in63.txt, in64.txt, in65.txt, in66.txt, in67.txt, in68.txt, in69.txt, in70.txt, in71.txt, in72.txt, in73.txt, in74.txt, in75.txt, in76.txt, in77.txt, in78.txt, in79.txt, in80.txt, in81.txt, in82.txt, in83.txt, in84.txt
Case Name Status Exec Time Memory
in01.txt AC 2 ms 3572 KiB
in02.txt AC 1 ms 3568 KiB
in03.txt AC 1 ms 3332 KiB
in04.txt AC 1 ms 3512 KiB
in05.txt AC 1 ms 3448 KiB
in06.txt AC 1 ms 3600 KiB
in07.txt AC 1 ms 3572 KiB
in08.txt AC 1 ms 3568 KiB
in09.txt AC 79 ms 8164 KiB
in10.txt AC 1 ms 3512 KiB
in11.txt AC 79 ms 9292 KiB
in12.txt AC 79 ms 8524 KiB
in13.txt AC 79 ms 8184 KiB
in14.txt AC 79 ms 7988 KiB
in15.txt AC 79 ms 8136 KiB
in16.txt AC 72 ms 8780 KiB
in17.txt AC 1 ms 3544 KiB
in18.txt AC 1 ms 3564 KiB
in19.txt AC 68 ms 8160 KiB
in20.txt AC 80 ms 8164 KiB
in21.txt AC 79 ms 8268 KiB
in22.txt AC 74 ms 8136 KiB
in23.txt AC 69 ms 8112 KiB
in24.txt AC 55 ms 8220 KiB
in25.txt AC 55 ms 8148 KiB
in26.txt AC 57 ms 8180 KiB
in27.txt AC 79 ms 8140 KiB
in28.txt AC 79 ms 8580 KiB
in29.txt AC 78 ms 8668 KiB
in30.txt AC 59 ms 7780 KiB
in31.txt AC 1 ms 3452 KiB
in32.txt AC 1 ms 3384 KiB
in33.txt AC 1 ms 3380 KiB
in34.txt AC 1 ms 3448 KiB
in35.txt AC 1 ms 3408 KiB
in36.txt AC 1 ms 3604 KiB
in37.txt AC 1 ms 3452 KiB
in38.txt AC 1 ms 3408 KiB
in39.txt AC 1 ms 3452 KiB
in40.txt AC 1 ms 3572 KiB
in41.txt AC 1 ms 3612 KiB
in42.txt AC 1 ms 3380 KiB
in43.txt AC 1 ms 3576 KiB
in44.txt AC 1 ms 3448 KiB
in45.txt AC 1 ms 3428 KiB
in46.txt AC 1 ms 3600 KiB
in47.txt AC 71 ms 8764 KiB
in48.txt AC 36 ms 6060 KiB
in49.txt AC 78 ms 9024 KiB
in50.txt AC 78 ms 9176 KiB
in51.txt AC 78 ms 8788 KiB
in52.txt AC 59 ms 7764 KiB
in53.txt AC 77 ms 8792 KiB
in54.txt AC 78 ms 8788 KiB
in55.txt AC 79 ms 8152 KiB
in56.txt AC 59 ms 7088 KiB
in57.txt AC 78 ms 8788 KiB
in58.txt AC 78 ms 8772 KiB
in59.txt AC 78 ms 8716 KiB
in60.txt AC 77 ms 8720 KiB
in61.txt AC 1 ms 3448 KiB
in62.txt AC 1 ms 3544 KiB
in63.txt AC 80 ms 8196 KiB
in64.txt AC 80 ms 8204 KiB
in65.txt AC 74 ms 8720 KiB
in66.txt AC 75 ms 8800 KiB
in67.txt AC 1 ms 3448 KiB
in68.txt AC 1 ms 3456 KiB
in69.txt AC 1 ms 3568 KiB
in70.txt AC 1 ms 3568 KiB
in71.txt AC 1 ms 3400 KiB
in72.txt AC 1 ms 3448 KiB
in73.txt AC 1 ms 3408 KiB
in74.txt AC 1 ms 3612 KiB
in75.txt AC 1 ms 3564 KiB
in76.txt AC 1 ms 3448 KiB
in77.txt AC 1 ms 3400 KiB
in78.txt AC 1 ms 3532 KiB
in79.txt AC 1 ms 3600 KiB
in80.txt AC 68 ms 8652 KiB
in81.txt AC 68 ms 8800 KiB
in82.txt AC 1 ms 3384 KiB
in83.txt AC 1 ms 3572 KiB
in84.txt AC 78 ms 8668 KiB
sample01.txt AC 1 ms 3612 KiB
sample02.txt AC 1 ms 3400 KiB
sample03.txt AC 1 ms 3564 KiB