답안 #539164

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
539164 2022-03-18T14:07:34 Z astoria Navigation 2 (JOI21_navigation2) C++17
컴파일 오류
0 ms 0 KB
#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;

//same = larger closer
//different = smaller closer
void Anna(int K, int N, int T, int A[], int B[]) {
    vector<int> adj[N+5];
    for(int i=0; i<(N-1); i++){
        adj[A[i]].push_back(B[i]);
        adj[B[i]].push_back(A[i]);
    }
    queue<int> q;
    int dist[N+5]; memset(dist,-1,sizeof(dist));
    int state[N+5];
    q.push(T);
    dist[T]=0;
    state[T]=0;
    while(!q.empty()){
        int v = q.front(); q.pop();
        for(int i : adj[v]){
            if(dist[i]!=-1) continue;
            dist[i] = dist[v] + 1;
            q.push(i);
            if(v > i) state[i] = state[v];
            else state[i] = !state[v];
        }
    }
    
    for(int i=1; i<=N; i++) Flag(i, state[i]);
}
#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;

void Bruno(int K, int S, int F, int L, int P[], int Q[]) {
	//cout<<"app"<<endl;
    for(int i=0; i<L; i++){
        if(P[i]>S && Q[i]==F){ Answer(P[i]); return;}
        if(P[i]<S && Q[i]!=F){ Answer(P[i]); return;}
    }
    Answer(S);
}

Compilation message

Anna.cpp: In function 'void Anna(int, int, int, int*, int*)':
Anna.cpp:30:29: error: 'Flag' was not declared in this scope
   30 |     for(int i=1; i<=N; i++) Flag(i, state[i]);
      |                             ^~~~

Bruno.cpp: In function 'void Bruno(int, int, int, int, int*, int*)':
Bruno.cpp:8:32: error: 'Answer' was not declared in this scope
    8 |         if(P[i]>S && Q[i]==F){ Answer(P[i]); return;}
      |                                ^~~~~~
Bruno.cpp:9:32: error: 'Answer' was not declared in this scope
    9 |         if(P[i]<S && Q[i]!=F){ Answer(P[i]); return;}
      |                                ^~~~~~
Bruno.cpp:11:5: error: 'Answer' was not declared in this scope
   11 |     Answer(S);
      |     ^~~~~~