Submission #892074

# Submission time Handle Problem Language Result Execution time Memory
892074 2023-12-24T18:28:02 Z MilosMilutinovic New Home (APIO18_new_home) C++14
Compilation error
0 ms 0 KB
// todo
#include <bits/stdc++.h>
 
using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, k, q;
  cin >> n >> k >> q;
  vector<int> x(n);
  vector<int> t(n);
  vector<int> a(n);
  vector<int> b(n);
  for (int i = 0; i < n; i++) {
    cin >> x[i] >> t[i] >> a[i] >> b[i];
    ++b[i];
  }
  vector<int> l(q);
  vector<int> y(q);
  for (int i = 0; i < n; i++) {
    cin >> l[i] >> y[i];
  }
  vector<int> xs;
  for (int i = 0; i < n; i++) {
    xs.push_back(a[i]);
    xs.push_back(b[i]);
  }
  for (int i = 0; i < q; i++) {
    xs.push_back(y[i]);
  }
  sort(xs.begin(), xs.end());
  xs.erase(unique(xs.begin(), xs.end()), xs.end());
  for (int i = 0; i < n; i++) {
    a[i] = (int) (lower_bound(xs.begin(), xs.end(), a[i]) - xs.begin());
    b[i] = (int) (lower_bound(xs.begin(), xs.end(), b[i]) - xs.begin());
  }
  for (int i = 0; i < q; i++) {
    y[i] = (int) (lower_bound(xs.begin(), xs.end(), y[i]) - xs.begin());
  }
  int T = (int) xs.size();
  vector<vector<int>> qs(T);
  for (int i = 0; i < n; i++) {
    qs[a[i]].push_back(i);
    qs[b[i]].push_back(~i);
  }
  set<tuple<int, int, int>> open;
  vector<array<int, 4>> ev;
  vector<set<int>> my(k);
  auto Insert = [&](int t, int x, int y) {
    {
      auto ptr = my[t].lower_bound(x);
      if (ptr != my[t].begin() && ptr != my[t].end()) {
        auto it = open.lower_bound({*prev(ptr), *ptr, -1});
        ev.emplace_back(get<0>(*it), get<1>(*it), get<2>(*it), y);
        open.erase(it);
      }
      if (ptr != my[t].end()) {
        
      }
      if (ptr != my[t].begin())
    }
    my[t].insert(x);
  };
  for (int i = 0; i < T; i++) {
    for (int j : qs[i]) {
      if (j >= 0) {
        Insert(t[j], x[j], i);
      } else {
        j = ~j;
        Remove(t[j], x[j], i);
      }
    }
  }
  return 0;
}

Compilation message

new_home.cpp: In lambda function:
new_home.cpp:62:5: error: expected primary-expression before '}' token
   62 |     }
      |     ^
new_home.cpp: In function 'int main()':
new_home.cpp:71:9: error: 'Remove' was not declared in this scope; did you mean 'remove'?
   71 |         Remove(t[j], x[j], i);
      |         ^~~~~~
      |         remove
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/c++allocator.h:33,
                 from /usr/include/c++/10/bits/allocator.h:46,
                 from /usr/include/c++/10/string:41,
                 from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from new_home.cpp:2:
/usr/include/c++/10/ext/new_allocator.h: In instantiation of 'void __gnu_cxx::new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = std::array<int, 4>; _Args = {const int&, const int&, const int&, int&}; _Tp = std::array<int, 4>]':
/usr/include/c++/10/bits/alloc_traits.h:512:17:   required from 'static void std::allocator_traits<std::allocator<_CharT> >::construct(std::allocator_traits<std::allocator<_CharT> >::allocator_type&, _Up*, _Args&& ...) [with _Up = std::array<int, 4>; _Args = {const int&, const int&, const int&, int&}; _Tp = std::array<int, 4>; std::allocator_traits<std::allocator<_CharT> >::allocator_type = std::allocator<std::array<int, 4> >]'
/usr/include/c++/10/bits/vector.tcc:115:30:   required from 'void std::vector<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {const int&, const int&, const int&, int&}; _Tp = std::array<int, 4>; _Alloc = std::allocator<std::array<int, 4> >]'
new_home.cpp:55:65:   required from here
/usr/include/c++/10/ext/new_allocator.h:150:4: error: new initializer expression list treated as compound expression [-fpermissive]
  150 |  { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); }
      |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/ext/new_allocator.h:150:4: error: no matching function for call to 'std::array<int, 4>::array(int&)'
In file included from /usr/include/c++/10/tuple:39,
                 from /usr/include/c++/10/functional:54,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:71,
                 from new_home.cpp:2:
/usr/include/c++/10/array:94:12: note: candidate: 'std::array<int, 4>::array()'
   94 |     struct array
      |            ^~~~~
/usr/include/c++/10/array:94:12: note:   candidate expects 0 arguments, 1 provided
/usr/include/c++/10/array:94:12: note: candidate: 'constexpr std::array<int, 4>::array(const std::array<int, 4>&)'
/usr/include/c++/10/array:94:12: note:   no known conversion for argument 1 from 'int' to 'const std::array<int, 4>&'
/usr/include/c++/10/array:94:12: note: candidate: 'constexpr std::array<int, 4>::array(std::array<int, 4>&&)'
/usr/include/c++/10/array:94:12: note:   no known conversion for argument 1 from 'int' to 'std::array<int, 4>&&'