# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
797697 | XJP12 | 수천개의 섬 (IOI22_islands) | C++17 | 컴파일 에러 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
vector<vector<pair<int,int>>> g;
vector<int> recorrido;
bool ya=false;
void dfs(int u, int pist){
vis[u]=true;
for(auto vv: g[u]){
if(!vis[vv.first]){
if(ya==true) recorrido.push_back(vv.second);
if(vv.second=pistacho){
ya=true;
}
dfs(vv.first);
if(ya==true) recorrido.pop_back();
}
}
}
vector<int> peanut(int pistacho){
int a=-1,b=-1,c=-1,d=-1;
int peanut1=-1, peanut2=-1;
for(int i=0; i<m; i++){
if(u[i]==pistacho){
if(peanut1==-1){
a=i;
peanut1=v[i];
}else{
b=i;
peanut2=v[i];
break;
}
}
}
for(int i=0; i<m; i++){
if(u[i]==peanut1){
if(v[i]==0){
c=i;
break;
}
}
}
for(int i=0; i<m; i++){
if(u[i]==peanut2){
if(v[i]==0){
d=i;
break;
}
}
}
vector<int> x(8);
x={a,c,b,d,c,a,d,b};
return x;
}
variant<bool,vector<int>> find_journey(int n, int m, vector<int> u, vector<int> v){
vi check(1001);
vector<pair<int,int>> p;
g.assign(n+1,p);
vis.assign(n+1,0);
bool ban=false;
int pistacho=-1;
for(int i=0; i<m; i++){
check[u[i]]++;
if(check[u[i]]>=3){
ban=true;
pistacho=min(pistacho,u[i]);
}
}
if(ban==false){
return false;
}
vector ans;
for(int i=0; i<m; i++){
g[u[i]].push_back({v[i],i});
}
if(pistacho!=0){
dfs(0,pistacho);
}
recorrido.push_back(peanut(pistacho));
return recorrido;
}
컴파일 시 표준 에러 (stderr) 메시지
islands.cpp: In function 'void dfs(int, int)': islands.cpp:10:2: error: 'vis' was not declared in this scope; did you mean 'vii'? 10 | vis[u]=true; | ^~~ | vii islands.cpp:14:17: error: 'pistacho' was not declared in this scope 14 | if(vv.second=pistacho){ | ^~~~~~~~ islands.cpp:17:16: error: too few arguments to function 'void dfs(int, int)' 17 | dfs(vv.first); | ^ islands.cpp:9:6: note: declared here 9 | void dfs(int u, int pist){ | ^~~ islands.cpp: In function 'std::vector<int> peanut(int)': islands.cpp:25:17: error: 'm' was not declared in this scope 25 | for(int i=0; i<m; i++){ | ^ islands.cpp:26:6: error: 'u' was not declared in this scope 26 | if(u[i]==pistacho){ | ^ islands.cpp:29:13: error: 'v' was not declared in this scope 29 | peanut1=v[i]; | ^ islands.cpp:32:13: error: 'v' was not declared in this scope 32 | peanut2=v[i]; | ^ islands.cpp:37:17: error: 'm' was not declared in this scope 37 | for(int i=0; i<m; i++){ | ^ islands.cpp:38:6: error: 'u' was not declared in this scope 38 | if(u[i]==peanut1){ | ^ islands.cpp:39:7: error: 'v' was not declared in this scope 39 | if(v[i]==0){ | ^ islands.cpp:45:17: error: 'm' was not declared in this scope 45 | for(int i=0; i<m; i++){ | ^ islands.cpp:46:6: error: 'u' was not declared in this scope 46 | if(u[i]==peanut2){ | ^ islands.cpp:47:7: error: 'v' was not declared in this scope 47 | if(v[i]==0){ | ^ 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:61:2: error: 'vis' was not declared in this scope; did you mean 'vii'? 61 | vis.assign(n+1,0); | ^~~ | vii islands.cpp:74:9: error: class template argument deduction failed: 74 | vector ans; | ^~~ islands.cpp:74:9: error: no matching function for call to 'vector()' 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 islands.cpp:1: /usr/include/c++/10/bits/stl_vector.h:653:2: note: candidate: 'template<class _Tp, class _Alloc, class _InputIterator, class> vector(_InputIterator, _InputIterator, const _Alloc&)-> std::vector<_Tp, _Alloc>' 653 | vector(_InputIterator __first, _InputIterator __last, | ^~~~~~ /usr/include/c++/10/bits/stl_vector.h:653:2: note: template argument deduction/substitution failed: islands.cpp:74:9: note: candidate expects 3 arguments, 0 provided 74 | vector ans; | ^~~ 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 islands.cpp:1: /usr/include/c++/10/bits/stl_vector.h:625:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::initializer_list<_Tp>, const allocator_type&)-> std::vector<_Tp, _Alloc>' 625 | vector(initializer_list<value_type> __l, | ^~~~~~ /usr/include/c++/10/bits/stl_vector.h:625:7: note: template argument deduction/substitution failed: islands.cpp:74:9: note: candidate expects 2 arguments, 0 provided 74 | vector ans; | ^~~ 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 islands.cpp:1: /usr/include/c++/10/bits/stl_vector.h:607:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&, const allocator_type&)-> std::vector<_Tp, _Alloc>' 607 | vector(vector&& __rv, const allocator_type& __m) | ^~~~~~ /usr/include/c++/10/bits/stl_vector.h:607:7: note: template argument deduction/substitution failed: islands.cpp:74:9: note: candidate expects 2 arguments, 0 provided 74 | vector ans; | ^~~ 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 islands.cpp:1: /usr/include/c++/10/bits/stl_vector.h:589:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::false_type)-> std::vector<_Tp, _Alloc>' 589 | vector(vector&& __rv, const allocator_type& __m, false_type) | ^~~~~~ /usr/include/c++/10/bits/stl_vector.h:589:7: note: template argument deduction/substitution failed: islands.cpp:74:9: note: candidate expects 3 arguments, 0 provided 74 | vector ans; | ^~~ 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 islands.cpp:1: /usr/include/c++/10/bits/stl_vector.h:585:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::true_type)-> std::vector<_Tp, _Alloc>' 585 | vector(vector&& __rv, const allocator_type& __m, true_type) noexcept | ^~~~~~ /usr/include/c++/10/bits/stl_vector.h:585:7: note: template argument deduction/substitution failed: islands.cpp:74:9: note: candidate expects 3 arguments, 0 provided 74 | vector ans; | ^~~ 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 islands.cpp:1: /usr/include/c++/10/bits/stl_vector.h:575:7: note: candidate: 'template<class _Tp, class _Alloc> vector(const std::vector<_Tp, _Alloc>&, const allocator_type&)-> std::vector<_Tp, _Alloc>' 575 | vector(const vector& __x, const allocator_type& __a) | ^~~~~~ /usr/include/c++/10/bits/stl_vector.h:575:7: note: template argument deduction/substitution failed: islands.cpp:74:9: note: candidate expects 2 arguments, 0 provided 74 | vector ans; | ^~~ 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 islands.cpp:1: /usr/include/c++/10/bits/stl_vector.h:572:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&)-> std::vector<_Tp, _Alloc>' 572 | vector(vector&&) noexcept = default; | ^~~~~~ /usr/include/c++/10/bits/stl_vector.h:572:7: note: template argument deduction/substitution failed: islands.cpp:74:9: note: candidate expects 1 argument, 0 provided 74 | vector ans; | ^~~ 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 islands.cpp:1: /usr/include/c++/10/bits/stl_vector.h:553:7: note: candidate: 'template<class _Tp, class _Alloc> vector(const std::vector<_Tp, _Alloc>&)-> std::vector<_Tp, _Alloc>' 553 | vector(const vector& __x) | ^~~~~~ /usr/include/c++/10/bits/stl_vector.h:553:7: note: template argument deduction/substitution failed: islands.cpp:74:9: note: candidate expects 1 argument, 0 provided 74 | vector ans; | ^~~ 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 islands.cpp:1: /usr/include/c++/10/bits/stl_vector.h:522:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>::size_type, const value_type&, const allocator_type&)-> std::vector<_Tp, _Alloc>' 522 | vector(size_type __n, const value_type& __value, | ^~~~~~ /usr/include/c++/10/bits/stl_vector.h:522:7: note: template argument deduction/substitution failed: islands.cpp:74:9: note: candidate expects 3 arguments, 0 provided 74 | vector ans; | ^~~ 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 islands.cpp:1: /usr/include/c++/10/bits/stl_vector.h:510:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>::size_type, const allocator_type&)-> std::vector<_Tp, _Alloc>' 510 | vector(size_type __n, const allocator_type& __a = allocator_type()) | ^~~~~~ /usr/include/c++/10/bits/stl_vector.h:510:7: note: template argument deduction/substitution failed: islands.cpp:74:9: note: candidate expects 2 arguments, 0 provided 74 | vector ans; | ^~~ 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 islands.cpp:1: /usr/include/c++/10/bits/stl_vector.h:497:7: note: candidate: 'template<class _Tp, class _Alloc> vector(const allocator_type&)-> std::vector<_Tp, _Alloc>' 497 | vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT | ^~~~~~ /usr/include/c++/10/bits/stl_vector.h:497:7: note: template argument deduction/substitution failed: islands.cpp:74:9: note: candidate expects 1 argument, 0 provided 74 | vector ans; | ^~~ 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 islands.cpp:1: /usr/include/c++/10/bits/stl_vector.h:487:7: note: candidate: 'template<class _Tp, class _Alloc> vector()-> std::vector<_Tp, _Alloc>' 487 | vector() = default; | ^~~~~~ /usr/include/c++/10/bits/stl_vector.h:487:7: note: template argument deduction/substitution failed: islands.cpp:74:9: note: couldn't deduce template parameter '_Tp' 74 | vector ans; | ^~~ 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 islands.cpp:1: /usr/include/c++/10/bits/stl_vector.h:389:11: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>)-> std::vector<_Tp, _Alloc>' 389 | class vector : protected _Vector_base<_Tp, _Alloc> | ^~~~~~ /usr/include/c++/10/bits/stl_vector.h:389:11: note: template argument deduction/substitution failed: islands.cpp:74:9: note: candidate expects 1 argument, 0 provided 74 | vector ans; | ^~~ 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 islands.cpp:1: /usr/include/c++/10/bits/stl_vector.h:1876:5: note: candidate: 'template<class _InputIterator, class _ValT, class _Allocator, class, class> std::vector(_InputIterator, _InputIterator, _Allocator)-> std::vector<_ValT, _Allocator>' 1876 | vector(_InputIterator, _InputIterator, _Allocator = _Allocator()) | ^~~~~~ /usr/include/c++/10/bits/stl_vector.h:1876:5: note: template argument deduction/substitution failed: islands.cpp:74:9: note: candidate expects 3 arguments, 0 provided 74 | vector ans; | ^~~ islands.cpp:81:38: error: no matching function for call to 'std::vector<int>::push_back(std::vector<int>)' 81 | recorrido.push_back(peanut(pistacho)); | ^ 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 islands.cpp:1: /usr/include/c++/10/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::value_type = int]' 1187 | push_back(const value_type& __x) | ^~~~~~~~~ /usr/include/c++/10/bits/stl_vector.h:1187:35: note: no known conversion for argument 1 from 'std::vector<int>' to 'const value_type&' {aka 'const int&'} 1187 | push_back(const value_type& __x) | ~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/10/bits/stl_vector.h:1203:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::value_type = int]' 1203 | push_back(value_type&& __x) | ^~~~~~~~~ /usr/include/c++/10/bits/stl_vector.h:1203:30: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::vector<int>::value_type&&' {aka 'int&&'} 1203 | push_back(value_type&& __x) | ~~~~~~~~~~~~~^~~