제출 #1113509

#제출 시각아이디문제언어결과실행 시간메모리
1113509imarnIsland Hopping (JOI24_island)C++17
컴파일 에러
0 ms0 KiB
#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); }

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

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);
      |                    ^