제출 #1129798

#제출 시각아이디문제언어결과실행 시간메모리
1129798ohadIsland Hopping (JOI24_island)C++20
컴파일 에러
0 ms0 KiB
#include "island.h" #include<bits/stdc++.h> using namespace std; void solve(int N, int L){ vector<int> father(N,-1); father[0] = -2; //no father vector<int> q; for(int i = 1; i < N; i++){ q.push_back(query(1,i)); } while(auto now : q){ for(int k = 1; father[now]==-1; k++){ int nei = query(now,k); if(father[nei]!=-1) father[now]=nei; else father[nei] = now; } } for (int i = 2; i <= N; i++) answer(i, father[i]); }

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

island.cpp: In function 'void solve(int, int)':
island.cpp:12:20: error: found ':' in nested-name-specifier, expected '::'
   12 |     while(auto now : q){
      |                    ^
      |                    ::
island.cpp:12:16: error: 'now' has not been declared
   12 |     while(auto now : q){
      |                ^~~
island.cpp:12:23: error: qualified-id in declaration before ')' token
   12 |     while(auto now : q){
      |                       ^
island.cpp:13:31: error: 'now' was not declared in this scope; did you mean 'pow'?
   13 |         for(int k = 1; father[now]==-1; k++){
      |                               ^~~
      |                               pow