제출 #1089921

#제출 시각아이디문제언어결과실행 시간메모리
1089921vjudge1Simurgh (IOI17_simurgh)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #include "simurgh.h" vector<int> odg; void f(vector<int> v,int p,int m,int n) { if (p==m) { if (count(common_roads(v))==m-1) odg = v; return; } f(v,p+1,m,n); if (v.size()<n-1) { v.push_back(p); f(v,p+1,m,n); } } vector<int> find_roads(int n, vector<int> u, vector<int> v) { f({},0,u.size(),n); return odg; } int main() { vector<int> odg = find_roads(4, [0, 0, 0, 1, 1, 2], [1, 2, 3, 2, 3, 3]); for (int i=0;i<odg.size();i++) cout<<odg[i]<<" "; return 0; }

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

simurgh.cpp: In function 'void f(std::vector<int>, int, int, int)':
simurgh.cpp:12:19: error: 'common_roads' was not declared in this scope; did you mean 'count_common_roads'?
   12 |         if (count(common_roads(v))==m-1) odg = v;
      |                   ^~~~~~~~~~~~
      |                   count_common_roads
simurgh.cpp:17:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   17 |     if (v.size()<n-1)
      |         ~~~~~~~~^~~~
simurgh.cpp: In function 'int main()':
simurgh.cpp:31:38: error: expected identifier before numeric constant
   31 |     vector<int> odg = find_roads(4, [0, 0, 0, 1, 1, 2], [1, 2, 3, 2, 3, 3]);
      |                                      ^
simurgh.cpp:31:39: error: expected ']' before ',' token
   31 |     vector<int> odg = find_roads(4, [0, 0, 0, 1, 1, 2], [1, 2, 3, 2, 3, 3]);
      |                                       ^
      |                                       ]
simurgh.cpp: In lambda function:
simurgh.cpp:31:39: error: expected '{' before ',' token
simurgh.cpp: In function 'int main()':
simurgh.cpp:31:54: error: expected ')' before ']' token
   31 |     vector<int> odg = find_roads(4, [0, 0, 0, 1, 1, 2], [1, 2, 3, 2, 3, 3]);
      |                                 ~                    ^
      |                                                      )
simurgh.cpp:32:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |     for (int i=0;i<odg.size();i++) cout<<odg[i]<<" ";
      |                  ~^~~~~~~~~~~