제출 #1139969

#제출 시각아이디문제언어결과실행 시간메모리
1139969brover29Amusement Park (JOI17_amusement_park)C++20
컴파일 에러
0 ms0 KiB
#include "Joi.h" using ll = long long; vector<ll>g[N]; ll used[N]; void dfs(ll v,ll x,ll i=0){ used[v]=1; MessageBoard(v,((x>>i)&1)); for(ll to:g[v]){ if(used[to])continue; dfs(to,x,i+1); break; } } void Joi(int n, int m, int U[], int V[], long long x, int T) { for(ll i=1;i<=m;i++){ ll v=V[i],u=U[i]; g[v].push_back(u); g[u].push_back(v); }for(ll i=0;i<n;i++)sort(g[i].begin(),g[i].end()); dfs(0,x); }
#include "Ioi.h" using ll = long long; ll ans,msg[N]; ll pr[N],used[N]; void dfs(ll v){ used[v]=1; for(ll to:g[v]){ if(used[to])continue; pr[to]=v; dfs(to); } }void calc(ll v,ll i=0){ used[v]=1; ans+=(1ll<<i)*msg[v]; for(ll to:g[v]){ if(used[to])continue; msg[to]=Move(v,to); dfs(to,i+1); break; } } long long Ioi(int n, int m, int U[], int V[], int P, int V, int T) { for(ll i=1;i<=m;i++){ ll v=V[i],u=U[i]; g[v].push_back(u); g[u].push_back(v); }for(ll i=0;i<n;i++)sort(g[i].begin(),g[i].end()); dfs(P); msg[P]=V; vector<ll>v; ll s=0; while(s!=P){ v.push_back(s); s=pr[s]; } reverse(v.begin(),v.end()); s=p; for(ll i:v){ msg[i]=Move(s,i); s=i; }for(ll i=0;i<n;i++)used[i]=0; calc(0); return ans; }

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

# 1번째 컴파일 단계

Joi.cpp:3:1: error: 'vector' does not name a type
    3 | vector<ll>g[N];
      | ^~~~~~
Joi.cpp:4:9: error: 'N' was not declared in this scope
    4 | ll used[N];
      |         ^
Joi.cpp: In function 'void dfs(ll, ll, ll)':
Joi.cpp:6:3: error: 'used' was not declared in this scope
    6 |   used[v]=1;
      |   ^~~~
Joi.cpp:8:13: error: 'g' was not declared in this scope
    8 |   for(ll to:g[v]){
      |             ^
Joi.cpp: In function 'void Joi(int, int, int*, int*, long long int, int)':
Joi.cpp:17:5: error: 'g' was not declared in this scope
   17 |     g[v].push_back(u);
      |     ^
Joi.cpp:19:28: error: 'g' was not declared in this scope
   19 |   }for(ll i=0;i<n;i++)sort(g[i].begin(),g[i].end());
      |                            ^
Joi.cpp:19:23: error: 'sort' was not declared in this scope; did you mean 'short'?
   19 |   }for(ll i=0;i<n;i++)sort(g[i].begin(),g[i].end());
      |                       ^~~~
      |                       short