제출 #1226612

#제출 시각아이디문제언어결과실행 시간메모리
1226612ssafarovMinerals (JOI19_minerals)C++20
컴파일 에러
0 ms0 KiB
#define Magic ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #pragma GCC optimize("Ofast") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include "minerals.h" #define ll int #define ld long long double #define en '\n' #define tsts int tetss; cin >> tetss; while(tetss--) #define all(a) a.begin() , a.end() #define pb push_back #define ld long long double #define fi first #define se second int lst; int op[100000] = {}; void func(vector<int> v, bool ok){ vector<int> v1, v2; int st = lst; int gps = v.size() / 2; if(v.size() == 2){ Answer(v[0], v[1]); return; } if(ok){ int sb = (gps + 1) / 2; for(auto g : v){ int nw = Query(g); if(nw == lst){ if(sb){ sb--; v1.push_back(g); } else{ nw = Query(g); v2.push_back(g); } }else{ v1.push_back(g); } lst = nw; } }else{ int sb = (gps + 1) / 2; for(auto g : v){ int nw = Query(g); if((nw - st) > sb){ nw = Query(g); v2.push_back(g); }else{ v1.push_back(g); } lst = nw; } } // if(ok == 1){ // return; // } func(v1, !ok); func(v2, ok); } void Solve(int n){ vector<int> v; for(int i = 1; i <= 2 * n; ++i){ v.push_back(i); } func(v, 0); }

컴파일 시 표준 에러 (stderr) 메시지

minerals.cpp:20:6: error: variable or field 'func' declared void
   20 | void func(vector<int> v, bool ok){
      |      ^~~~
minerals.cpp:20:11: error: 'vector' was not declared in this scope
   20 | void func(vector<int> v, bool ok){
      |           ^~~~~~
minerals.cpp:20:11: note: suggested alternatives:
In file included from /usr/include/c++/11/vector:67,
                 from /usr/include/c++/11/functional:62,
                 from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from minerals.cpp:3:
/usr/include/c++/11/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from /usr/include/c++/11/functional:62,
                 from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from minerals.cpp:3:
/usr/include/c++/11/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
minerals.cpp:20:18: error: expected primary-expression before 'int'
   20 | void func(vector<int> v, bool ok){
      |                  ^~~
minerals.cpp:20:26: error: expected primary-expression before 'bool'
   20 | void func(vector<int> v, bool ok){
      |                          ^~~~
minerals.cpp: In function 'void Solve(int)':
minerals.cpp:67:9: error: 'vector' was not declared in this scope
   67 |         vector<int> v;
      |         ^~~~~~
minerals.cpp:67:9: note: suggested alternatives:
In file included from /usr/include/c++/11/vector:67,
                 from /usr/include/c++/11/functional:62,
                 from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from minerals.cpp:3:
/usr/include/c++/11/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from /usr/include/c++/11/functional:62,
                 from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from minerals.cpp:3:
/usr/include/c++/11/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
minerals.cpp:67:16: error: expected primary-expression before 'int'
   67 |         vector<int> v;
      |                ^~~
minerals.cpp:69:17: error: 'v' was not declared in this scope
   69 |                 v.push_back(i);
      |                 ^
minerals.cpp:71:14: error: 'v' was not declared in this scope
   71 |         func(v, 0);
      |              ^
minerals.cpp:71:9: error: 'func' was not declared in this scope
   71 |         func(v, 0);
      |         ^~~~