답안 #1110267

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1110267 2024-11-09T03:57:01 Z vjudge1 Card Collection (JOI24_collection) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#define rep(i, b, e) for(int i = (b); i <= (e); i++)
#define per(i, b, e) for(int i = (e); i >= (b); i--)
#define FOR(i, b, e) rep(i, b, (e) - 1)
#define SZ(x) int(x.size())
#define all(x) x.begin(), x.end()
#define pb push_back
#define mp make_pair
#define st first
#define nd second
using ll = long long;
using vi = vector<int>;
using pii = pair<int, int>;
 
auto &operator<<(auto &o, pair<auto, auto> p) {
	return o << "(" << p.st << ", " << p.nd << ")"; }
auto operator<<(auto &o, auto x)->decltype(end(x), o) {
	o << "{"; int i=0; for(auto e: x) o << ", " + 2*!i++ << e;
	return o << "}"; }
#ifdef LOCAL
#define deb(x...) cerr << "[" #x "]: ", [](auto...$) { \
	((cerr << $ << "; "),...) << endl; }(x)
#else
#define deb(...)
#endif
 
set<pair<int, int> > S[20][20];
 
void solve() {
	int n, m;
    cin>>n>>m;
    vector<pii> co(n);
    for(auto &[x,y]:co){
        cin>>x>>y;
    }
    for(int i=0; i<n; i++){
        S[i][i].insert(co[i]);
    }
    for(int d=1; d<n; d++){
        for(int i=0; i+d<n; i++){
            for(int j=i; j<i+d; j++){
                for(auto &[x, y] : S[i][j]){
                    for(auto &[x2, y2] : S[j+1][i+d]){
                        S[i][i+d].insert(mp(min(x, x2), min(y, y2)));
                        S[i][i+d].insert(mp(max(x, x2), max(y, y2)));
                    }
                }
            }
        }
    }
    for(int i=1; i<=m; i++){
        int x, y;
        cin>>x>>y;
        if(S[0][n-1].find(mp(x, y))!=S[0][n-1].end()){
            cout<<i<<" ";
        }
    }
    cout<<"\n";
}
 
int main() {
	cin.tie(0)->sync_with_stdio(0);
	int tt = 1;
	// cin >> tt;
	FOR(te, 0, tt) solve();
	return 0;
}

Compilation message

Main.cpp:12:12: error: 'vector' does not name a type
   12 | using vi = vector<int>;
      |            ^~~~~~
Main.cpp:13:13: error: 'pair' does not name a type
   13 | using pii = pair<int, int>;
      |             ^~~~
Main.cpp:15:18: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   15 | auto &operator<<(auto &o, pair<auto, auto> p) {
      |                  ^~~~
Main.cpp:15:27: error: 'pair' has not been declared
   15 | auto &operator<<(auto &o, pair<auto, auto> p) {
      |                           ^~~~
Main.cpp:15:31: error: expected ',' or '...' before '<' token
   15 | auto &operator<<(auto &o, pair<auto, auto> p) {
      |                               ^
Main.cpp: In function 'auto& operator<<(auto:23&, int)':
Main.cpp:16:21: error: 'p' was not declared in this scope
   16 |  return o << "(" << p.st << ", " << p.nd << ")"; }
      |                     ^
Main.cpp: At global scope:
Main.cpp:17:17: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   17 | auto operator<<(auto &o, auto x)->decltype(end(x), o) {
      |                 ^~~~
Main.cpp:17:26: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   17 | auto operator<<(auto &o, auto x)->decltype(end(x), o) {
      |                          ^~~~
Main.cpp:27:1: error: 'set' does not name a type; did you mean 'st'?
   27 | set<pair<int, int> > S[20][20];
      | ^~~
      | st
Main.cpp: In function 'void solve()':
Main.cpp:31:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   31 |     cin>>n>>m;
      |     ^~~
      |     std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:75,
                 from Main.cpp:1:
/usr/include/c++/10/iostream:60:18: note: 'std::cin' declared here
   60 |   extern istream cin;  /// Linked to standard input
      |                  ^~~
Main.cpp:32:5: error: 'vector' was not declared in this scope
   32 |     vector<pii> co(n);
      |     ^~~~~~
Main.cpp:32:5: note: suggested alternatives:
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/functional:62,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from Main.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from /usr/include/c++/10/functional:62,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from Main.cpp:1:
/usr/include/c++/10/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
Main.cpp:32:12: error: 'pii' was not declared in this scope
   32 |     vector<pii> co(n);
      |            ^~~
Main.cpp:32:17: error: 'co' was not declared in this scope; did you mean 'cos'?
   32 |     vector<pii> co(n);
      |                 ^~
      |                 cos
Main.cpp:37:9: error: 'S' was not declared in this scope
   37 |         S[i][i].insert(co[i]);
      |         ^
Main.cpp:42:36: error: 'S' was not declared in this scope
   42 |                 for(auto &[x, y] : S[i][j]){
      |                                    ^
Main.cpp:44:45: error: 'min' was not declared in this scope; did you mean 'std::min'?
   44 |                         S[i][i+d].insert(mp(min(x, x2), min(y, y2)));
      |                                             ^~~
      |                                             std::min
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from Main.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3474:5: note: 'std::min' declared here
 3474 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
Main.cpp:8:12: error: 'make_pair' was not declared in this scope; did you mean 'std::make_pair'?
    8 | #define mp make_pair
      |            ^~~~~~~~~
Main.cpp:44:42: note: in expansion of macro 'mp'
   44 |                         S[i][i+d].insert(mp(min(x, x2), min(y, y2)));
      |                                          ^~
In file included from /usr/include/c++/10/bits/stl_algobase.h:64,
                 from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from Main.cpp:1:
/usr/include/c++/10/bits/stl_pair.h:567:5: note: 'std::make_pair' declared here
  567 |     make_pair(_T1&& __x, _T2&& __y)
      |     ^~~~~~~~~
Main.cpp:45:45: error: 'max' was not declared in this scope; did you mean 'std::max'?
   45 |                         S[i][i+d].insert(mp(max(x, x2), max(y, y2)));
      |                                             ^~~
      |                                             std::max
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from Main.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3486:5: note: 'std::max' declared here
 3486 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
Main.cpp:54:12: error: 'S' was not declared in this scope
   54 |         if(S[0][n-1].find(mp(x, y))!=S[0][n-1].end()){
      |            ^
Main.cpp:8:12: error: 'make_pair' was not declared in this scope; did you mean 'std::make_pair'?
    8 | #define mp make_pair
      |            ^~~~~~~~~
Main.cpp:54:27: note: in expansion of macro 'mp'
   54 |         if(S[0][n-1].find(mp(x, y))!=S[0][n-1].end()){
      |                           ^~
In file included from /usr/include/c++/10/bits/stl_algobase.h:64,
                 from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from Main.cpp:1:
/usr/include/c++/10/bits/stl_pair.h:567:5: note: 'std::make_pair' declared here
  567 |     make_pair(_T1&& __x, _T2&& __y)
      |     ^~~~~~~~~
Main.cpp:55:13: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   55 |             cout<<i<<" ";
      |             ^~~~
      |             std::cout
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:75,
                 from Main.cpp:1:
/usr/include/c++/10/iostream:61:18: note: 'std::cout' declared here
   61 |   extern ostream cout;  /// Linked to standard output
      |                  ^~~~
Main.cpp:58:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   58 |     cout<<"\n";
      |     ^~~~
      |     std::cout
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:75,
                 from Main.cpp:1:
/usr/include/c++/10/iostream:61:18: note: 'std::cout' declared here
   61 |   extern ostream cout;  /// Linked to standard output
      |                  ^~~~
Main.cpp: In function 'int main()':
Main.cpp:62:2: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   62 |  cin.tie(0)->sync_with_stdio(0);
      |  ^~~
      |  std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:75,
                 from Main.cpp:1:
/usr/include/c++/10/iostream:60:18: note: 'std::cin' declared here
   60 |   extern istream cin;  /// Linked to standard input
      |                  ^~~