제출 #464168

#제출 시각아이디문제언어결과실행 시간메모리
464168koioi.org-dennisstar카멜레온의 사랑 (JOI20_chameleon)C++17
컴파일 에러
0 ms0 KiB
#include "chameleon.h" #include <bits/stdc++.h> using namespace std; void Solve(int n) { vector<vector<int>> adj(n+1); for (int i=1; i<n; i++) for (int j=i+1; j<=n; j++) { vector<int> v(2); v[0]=i, v[1]=j; if (Query(v)==1) adj[i].emplace_back(j), adj[j].emplace_back(i); } auto chk(int x, int y) = [&] { int f1=0, f2=0; vector<int> v(3); v[0]=x, v[1]=y; for (auto &i:adj[x]) if (i!=y) { v[2]=i; if (Query(v)==1) { f1=1; break; } } for (auto &i:adj[y]) if (i!=x) { v[2]=i; if (Query(v)==1) { f2=1; break; } } return f1&&f2; }; for (int i=1; i<=n; i++) for (auto &j:adj[i]) if (chk(i, j)) { Answer(i, j); adj[j].clear(); break; } }

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

chameleon.cpp: In function 'void Solve(int)':
chameleon.cpp:13:23: warning: declaration of 'auto chk(int, int)' has 'extern' and is initialized
   13 |  auto chk(int x, int y) = [&] {
      |                       ^
chameleon.cpp:13:28: error: invalid pure specifier (only '= 0' is allowed) before '&' token
   13 |  auto chk(int x, int y) = [&] {
      |                            ^
chameleon.cpp:13:7: error: function 'auto chk(int, int)' is initialized like a variable
   13 |  auto chk(int x, int y) = [&] {
      |       ^~~
chameleon.cpp:27:60: error: use of 'auto chk(int, int)' before deduction of 'auto'
   27 |  for (int i=1; i<=n; i++) for (auto &j:adj[i]) if (chk(i, j)) {
      |                                                            ^