답안 #1018887

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1018887 2024-07-10T10:39:34 Z Aiperiii Island Hopping (JOI24_island) C++17
컴파일 오류
0 ms 0 KB
#include "island.h"
#include <bits/stdc++.h>
//#define int long long
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define pb push_back
using namespace std;
int query(int i,int k){

void solve(int N,int L){
    vector <int> ord,pos(N+1),p(N+1);
    for(int i=1;i<N;i++){
        ord.pb(query(1,i));
    }
    for(int i=0;i<ord.size();i++){
       
        pos[ord[i]]=i+1;
    }
    for(int i=0;i<ord.size();i++){
        if(!p[ord[i]]){
            for(int k=1;k<N;k++){
                int v=query(ord[i],k);
                if(pos[v]<pos[ord[i]]){
                    p[ord[i]]=v;
                    break;
                }
                else{
                    p[v]=ord[i];
                }
            }
        }
    }
    for(int i=2;i<=N;i++){
        answer(i,p[i]);
    }
    
}

Compilation message

island.cpp: In function 'int query(int, int)':
island.cpp:11:24: error: a function-definition is not allowed here before '{' token
   11 | void solve(int N,int L){
      |                        ^
island.cpp:38:1: error: expected '}' at end of input
   38 | }
      | ^
island.cpp:9:23: note: to match this '{'
    9 | int query(int i,int k){
      |                       ^
island.cpp:38:1: warning: no return statement in function returning non-void [-Wreturn-type]
   38 | }
      | ^