Submission #1139970

#TimeUsernameProblemLanguageResultExecution timeMemory
1139970brover29Amusement Park (JOI17_amusement_park)C++20
Compilation error
0 ms0 KiB
#include "Joi.h"
#include <bits/stdc++.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 <bits/stdc++.h>
#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;
}

Compilation message (stderr)

# 1번째 컴파일 단계

Joi.cpp:4:1: error: 'vector' does not name a type
    4 | vector<ll>g[N];
      | ^~~~~~
Joi.cpp:5:9: error: 'N' was not declared in this scope
    5 | ll used[N];
      |         ^
Joi.cpp: In function 'void dfs(ll, ll, ll)':
Joi.cpp:7:3: error: 'used' was not declared in this scope
    7 |   used[v]=1;
      |   ^~~~
Joi.cpp:9:13: error: 'g' was not declared in this scope
    9 |   for(ll to:g[v]){
      |             ^
Joi.cpp: In function 'void Joi(int, int, int*, int*, long long int, int)':
Joi.cpp:18:5: error: 'g' was not declared in this scope
   18 |     g[v].push_back(u);
      |     ^
Joi.cpp:20:28: error: 'g' was not declared in this scope
   20 |   }for(ll i=0;i<n;i++)sort(g[i].begin(),g[i].end());
      |                            ^
Joi.cpp:20:23: error: 'sort' was not declared in this scope
   20 |   }for(ll i=0;i<n;i++)sort(g[i].begin(),g[i].end());
      |                       ^~~~
Joi.cpp:20:23: note: suggested alternatives:
In file included from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from Joi.cpp:2:
/usr/include/c++/11/pstl/glue_algorithm_defs.h:296:1: note:   'std::sort'
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
In file included from /usr/include/c++/11/algorithm:64,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from Joi.cpp:2:
/usr/include/c++/11/bits/ranges_algo.h:1834:30: note:   'std::ranges::sort'
 1834 |   inline constexpr __sort_fn sort{};
      |                              ^~~~