답안 #1113509

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1113509 2024-11-16T17:08:34 Z imarn Island Hopping (JOI24_island) C++17
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define plx pair<ll,int>
#define f first
#define s second
#define pb push_back
#define all(x) x.begin(),x.end()
#define szz(r) (ll)r.size()
#define vi vector<int>
#define vvi vector<vi>
#define pp pair<ll,int>
#define ub(x,i) upper_bound(all(x),i)-x.begin()
using namespace std;
#include "island.h"

void solve(int N, int L) {
    vector<int>vec;
    for(int i=1;i<=n-1;i++)vec.pb(query(1,i));
    int pr[N+1]={0};
    for(int i=2;i<=n;i++){
        int u=vec[i];
        for(int j=1;j<=n-1;j++){
            int v=query(u,j);
            if(!pr[v])continue;
            else {pr[u]=v;break;}
        }
    }
    for(int i=2;i<=n;i++)answer(pr[i],i);
}

Compilation message

island.cpp: In function 'void solve(int, int)':
island.cpp:20:20: error: 'n' was not declared in this scope
   20 |     for(int i=1;i<=n-1;i++)vec.pb(query(1,i));
      |                    ^
island.cpp:22:20: error: 'n' was not declared in this scope
   22 |     for(int i=2;i<=n;i++){
      |                    ^
island.cpp:30:20: error: 'n' was not declared in this scope
   30 |     for(int i=2;i<=n;i++)answer(pr[i],i);
      |                    ^