| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 667023 | mychecksedad | 수천개의 섬 (IOI22_islands) | C++17 | 컴파일 에러 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include <utility>
#include <variant>
using namespace std;
#define pb push_back
variant<bool, vector<int>> find_journey(int N, int M, vector<int> U, vector<int> V){
vector<int> a, b;
for(int i = 0; i < M; ++i) if(U[i] == 0) a.pb(i);
for(int i = 0; i < M; ++i) if(U[i] == 1) b.pb(i);
variant<bool, vector<int>> ans (0, {});
if(a.size() >= 2 && b.size() >= 1){
ans = variant(1, {a[0], b[0], a[1], a[0], b[0], a[1]});
return ans;
}
return ans;
}
컴파일 시 표준 에러 (stderr) 메시지
islands.cpp: In function 'std::variant<bool, std::vector<int, std::allocator<int> > > find_journey(int, int, std::vector<int>, std::vector<int>)':
islands.cpp:11:42: error: no matching function for call to 'std::variant<bool, std::vector<int, std::allocator<int> > >::variant(int, <brace-enclosed initializer list>)'
11 | variant<bool, vector<int>> ans (0, {});
| ^
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:133,
from islands.cpp:1:
/usr/include/c++/10/variant:1402:2: note: candidate: 'template<long unsigned int _Np, class _Up, class ... _Args, class _Tp, class> constexpr std::variant<_Types>::variant(std::in_place_index_t<_Np>, std::initializer_list<_Up>, _Args&& ...) [with long unsigned int _Np = _Np; _Up = _Up; _Args = {_Args ...}; _Tp = _Tp; <template-parameter-2-5> = <template-parameter-1-5>; _Types = {bool, std::vector<int, std::allocator<int> >}]'
1402 | variant(in_place_index_t<_Np>, initializer_list<_Up> __il,
| ^~~~~~~
/usr/include/c++/10/variant:1402:2: note: template argument deduction/substitution failed:
islands.cpp:11:42: note: mismatched types 'std::in_place_index_t<_Idx>' and 'int'
11 | variant<bool, vector<int>> ans (0, {});
| ^
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:133,
from islands.cpp:1:
/usr/include/c++/10/variant:1391:2: note: candidate: 'template<long unsigned int _Np, class ... _Args, class _Tp, class> constexpr std::variant<_Types>::variant(std::in_place_index_t<_Np>, _Args&& ...) [with long unsigned int _Np = _Np; _Args = {_Args ...}; _Tp = _Tp; <template-parameter-2-4> = <template-parameter-1-4>; _Types = {bool, std::vector<int, std::allocator<int> >}]'
1391 | variant(in_place_index_t<_Np>, _Args&&... __args)
| ^~~~~~~
/usr/include/c++/10/variant:1391:2: note: template argument deduction/substitution failed:
islands.cpp:11:42: note: mismatched types 'std::in_place_index_t<_Idx>' and 'int'
11 | variant<bool, vector<int>> ans (0, {});
| ^
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:133,
from islands.cpp:1:
/usr/include/c++/10/variant:1381:2: note: candidate: 'template<class _Tp, class _Up, class ... _Args, class> constexpr std::variant<_Types>::variant(std::in_place_type_t<_Tp>, std::initializer_list<_Up>, _Args&& ...) [with _Tp = _Tp; _Up = _Up; _Args = {_Args ...}; <template-parameter-2-4> = <template-parameter-1-4>; _Types = {bool, std::vector<int, std::allocator<int> >}]'
1381 | variant(in_place_type_t<_Tp>, initializer_list<_Up> __il,
| ^~~~~~~
/usr/include/c++/10/variant:1381:2: note: template argument deduction/substitution failed:
islands.cpp:11:42: note: mismatched types 'std::in_place_type_t<_Tp>' and 'int'
11 | variant<bool, vector<int>> ans (0, {});
| ^
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:133,
from islands.cpp:1:
/usr/include/c++/10/variant:1371:2: note: candidate: 'template<class _Tp, class ... _Args, class> constexpr std::variant<_Types>::variant(std::in_place_type_t<_Tp>, _Args&& ...) [with _Tp = _Tp; _Args = {_Args ...}; <template-parameter-2-3> = <template-parameter-1-3>; _Types = {bool, std::vector<int, std::allocator<int> >}]'
1371 | variant(in_place_type_t<_Tp>, _Args&&... __args)
| ^~~~~~~
/usr/include/c++/10/variant:1371:2: note: template argument deduction/substitution failed:
islands.cpp:11:42: note: mismatched types 'std::in_place_type_t<_Tp>' and 'int'
11 | variant<bool, vector<int>> ans (0, {});
| ^
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:133,
from islands.cpp:1:
/usr/include/c++/10/variant:1361:2: note: candidate: 'template<class _Tp, class, class, class _Tj, class> constexpr std::variant<_Types>::variant(_Tp&&) [with _Tp = _Tp; <template-parameter-2-2> = <template-parameter-1-2>; <template-parameter-2-3> = <template-parameter-1-3>; _Tj = _Tj; <template-parameter-2-5> = <template-parameter-1-5>; _Types = {bool, std::vector<int, std::allocator<int> >}]'
1361 | variant(_Tp&& __t)
| ^~~~~~~
/usr/include/c++/10/variant:1361:2: note: template argument deduction/substitution failed:
islands.cpp:11:42: note: candidate expects 1 argument, 2 provided
11 | variant<bool, vector<int>> ans (0, {});
| ^
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:133,
from islands.cpp:1:
/usr/include/c++/10/variant:1349:7: note: candidate: 'std::variant<_Types>::variant(std::variant<_Types>&&) [with _Types = {bool, std::vector<int, std::allocator<int> >}]'
1349 | variant(variant&&) = default;
| ^~~~~~~
/usr/include/c++/10/variant:1349:7: note: candidate expects 1 argument, 2 provided
/usr/include/c++/10/variant:1348:7: note: candidate: 'std::variant<_Types>::variant(const std::variant<_Types>&) [with _Types = {bool, std::vector<int, std::allocator<int> >}]'
1348 | variant(const variant& __rhs) = default;
| ^~~~~~~
/usr/include/c++/10/variant:1348:7: note: candidate expects 1 argument, 2 provided
/usr/include/c++/10/variant:1347:7: note: candidate: 'constexpr std::variant<_Types>::variant() [with _Types = {bool, std::vector<int, std::allocator<int> >}]'
1347 | variant() = default;
| ^~~~~~~
/usr/include/c++/10/variant:1347:7: note: candidate expects 0 arguments, 2 provided
islands.cpp:13:62: error: class template argument deduction failed:
13 | ans = variant(1, {a[0], b[0], a[1], a[0], b[0], a[1]});
| ^
islands.cpp:13:62: error: no matching function for call to 'variant(int, <brace-enclosed initializer list>)'
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:133,
from islands.cpp:1:
/usr/include/c++/10/variant:1402:2: note: candidate: 'template<class ... _Types, long unsigned int _Np, class _Up, class ... _Args, class _Tp, class> variant(std::in_place_index_t<_Np>, std::initializer_list<_Up>, _Args&& ...)-> std::variant<_Types>'
1402 | variant(in_place_index_t<_Np>, initializer_list<_Up> __il,
| ^~~~~~~
/usr/include/c++/10/variant:1402:2: note: template argument deduction/substitution failed:
islands.cpp:13:62: note: mismatched types 'std::in_place_index_t<_Np>' and 'int'
13 | ans = variant(1, {a[0], b[0], a[1], a[0], b[0], a[1]});
| ^
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:133,
from islands.cpp:1:
/usr/include/c++/10/variant:1391:2: note: candidate: 'template<class ... _Types, long unsigned int _Np, class ... _Args, class _Tp, class> variant(std::in_place_index_t<_Np>, _Args&& ...)-> std::variant<_Types>'
1391 | variant(in_place_index_t<_Np>, _Args&&... __args)
| ^~~~~~~
/usr/include/c++/10/variant:1391:2: note: template argument deduction/substitution failed:
islands.cpp:13:62: note: mismatched types 'std::in_place_index_t<_Np>' and 'int'
13 | ans = variant(1, {a[0], b[0], a[1], a[0], b[0], a[1]});
| ^
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:133,
from islands.cpp:1:
/usr/include/c++/10/variant:1381:2: note: candidate: 'template<class ... _Types, class _Tp, class _Up, class ... _Args, class> variant(std::in_place_type_t<_Tp>, std::initializer_list<_Up>, _Args&& ...)-> std::variant<_Types>'
1381 | variant(in_place_type_t<_Tp>, initializer_list<_Up> __il,
| ^~~~~~~
/usr/include/c++/10/variant:1381:2: note: template argument deduction/substitution failed:
islands.cpp:13:62: note: mismatched types 'std::in_place_type_t<_Tp>' and 'int'
13 | ans = variant(1, {a[0], b[0], a[1], a[0], b[0], a[1]});
| ^
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:133,
from islands.cpp:1:
/usr/include/c++/10/variant:1371:2: note: candidate: 'template<class ... _Types, class _Tp, class ... _Args, class> variant(std::in_place_type_t<_Tp>, _Args&& ...)-> std::variant<_Types>'
1371 | variant(in_place_type_t<_Tp>, _Args&&... __args)
| ^~~~~~~
/usr/include/c++/10/variant:1371:2: note: template argument deduction/substitution failed:
islands.cpp:13:62: note: mismatched types 'std::in_place_type_t<_Tp>' and 'int'
13 | ans = variant(1, {a[0], b[0], a[1], a[0], b[0], a[1]});
| ^
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:133,
from islands.cpp:1:
/usr/include/c++/10/variant:1361:2: note: candidate: 'template<class ... _Types, class _Tp, class, class, class _Tj, class> variant(_Tp&&)-> std::variant<_Types>'
1361 | variant(_Tp&& __t)
| ^~~~~~~
/usr/include/c++/10/variant:1361:2: note: template argument deduction/substitution failed:
islands.cpp:13:62: note: candidate expects 1 argument, 2 provided
13 | ans = variant(1, {a[0], b[0], a[1], a[0], b[0], a[1]});
| ^
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:133,
from islands.cpp:1:
/usr/include/c++/10/variant:1349:7: note: candidate: 'template<class ... _Types> variant(std::variant<_Types>&&)-> std::variant<_Types>'
1349 | variant(variant&&) = default;
| ^~~~~~~
/usr/include/c++/10/variant:1349:7: note: template argument deduction/substitution failed:
islands.cpp:13:62: note: mismatched types 'std::variant<_Types>' and 'int'
13 | ans = variant(1, {a[0], b[0], a[1], a[0], b[0], a[1]});
| ^
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:133,
from islands.cpp:1:
/usr/include/c++/10/variant:1348:7: note: candidate: 'template<class ... _Types> variant(const std::variant<_Types>&)-> std::variant<_Types>'
1348 | variant(const variant& __rhs) = default;
| ^~~~~~~
/usr/include/c++/10/variant:1348:7: note: template argument deduction/substitution failed:
islands.cpp:13:62: note: mismatched types 'const std::variant<_Types>' and 'int'
13 | ans = variant(1, {a[0], b[0], a[1], a[0], b[0], a[1]});
| ^
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:133,
from islands.cpp:1:
/usr/include/c++/10/variant:1347:7: note: candidate: 'template<class ... _Types> variant()-> std::variant<_Types>'
1347 | variant() = default;
| ^~~~~~~
/usr/include/c++/10/variant:1347:7: note: template argument deduction/substitution failed:
islands.cpp:13:62: note: candidate expects 0 arguments, 2 provided
13 | ans = variant(1, {a[0], b[0], a[1], a[0], b[0], a[1]});
| ^
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:133,
from islands.cpp:1:
/usr/include/c++/10/variant:77:38: note: candidate: 'template<class ... _Types> variant(std::variant<_Types>)-> std::variant<_Types>'
77 | template<typename... _Types> class variant;
| ^~~~~~~
/usr/include/c++/10/variant:77:38: note: template argument deduction/substitution failed:
islands.cpp:13:62: note: mismatched types 'std::variant<_Types>' and 'int'
13 | ans = variant(1, {a[0], b[0], a[1], a[0], b[0], a[1]});
| ^
islands.cpp:13:62: error: expression list treated as compound expression in functional cast [-fpermissive]
islands.cpp:13:23: warning: left operand of comma operator has no effect [-Wunused-value]
13 | ans = variant(1, {a[0], b[0], a[1], a[0], b[0], a[1]});
| ^