Submission #1174206

#TimeUsernameProblemLanguageResultExecution timeMemory
1174206Zero_OPAmusement Park (JOI17_amusement_park)C++20
Compilation error
0 ms0 KiB
#include "Joi.h"

using namespace std;

using ll = long long;
using db = double;
using ld = long double;
using ull = unsigned long long;

using pi = pair<int, int>;
using pl = pair<ll, ll>;

using vi = vector<int>;
using vl = vector<ll>;
using vc = vector<char>;
using vb = vector<bool>;

using vpi = vector<pi>;
using vpl = vector<pl>;

struct DSU{
      vi lab;
      DSU(int n) : lab(n, -1) {}

      int root(int u){
            return lab[u] < 0 ? u : (lab[u] = root(lab[u]));
      }

      bool join(int u, int v){
            u = root(u);
            v = root(v);
            if(u == v) return false;
            if(lab[u] > lab[v]) swap(u, v);
            lab[u] += lab[v];
            lab[v] = u;
            return true;
      }
};

const int MAX = 1e4 + 5;

int depth[MAX], par[MAX], max_depth[MAX], timer_dfs, c[MAX];
vi adj[MAX];

void dfs(int u, int p){
      max_depth[u] = depth[u];
      for(auto v : adj[u]) if(v != p){
            par[v] = u;
            depth[v] = depth[u] + 1;
            dfs(v, u);
            maximize(max_depth[u], max_depth[v]);
      }
}

void dfs_mark(int u, int p, ll target){
      c[u] = (target >> (depth[u] % 60) & 1);
      for(auto v : adj[u]) if(v != p){
            dfs_mark(v, u, target);
      }
}

void dfs_cover(int u, int p, ll target){
      if(timer_dfs == 60) return;
      c[u] = timer_dfs++;
      for(auto v : adj[u]) if(v != p){
            dfs_cover(v, u, target);
      }
}

void Joi(int N, int M, int A[], int B[], long long X, int T) {
      DSU dsu(N);
      FOR(i, 0, M){
            if(dsu.join(A[i], B[i])){
                  adj[A[i]].pb(B[i]);
                  adj[B[i]].pb(A[i]);
            }
      }

      dfs(0, -1);
      fill(c, c + N, -1);

      if(max_depth[u] >= 59){
            dfs_mark(0, -1, X);
            FOR(i, 0, N) MessageBoard(i, c[i]);
      } else{
            FOR(i, 0, N){
                  sort(all(adj[i]), [&](int u, int v){ return max_depth[u] < max_depth[v]; });
            }

            dfs_cover(0, -1, X);
            FOR(i, 0, N) {
                  if(c[i] != -1) MessageBoard(i, c[i]);
                  else MessageBoard(i, 0);
            }
      }
}
really fun
#include "Ioi.h"

using namespace std;

using ll = long long;
using db = double;
using ld = long double;
using ull = unsigned long long;

using pi = pair<int, int>;
using pl = pair<ll, ll>;

using vi = vector<int>;
using vl = vector<ll>;
using vc = vector<char>;
using vb = vector<bool>;

using vpi = vector<pi>;
using vpl = vector<pl>;

struct DSU{
      vi lab;
      DSU(int n) : lab(n, -1) {}

      int root(int u){
            return lab[u] < 0 ? u : (lab[u] = root(lab[u]));
      }

      bool join(int u, int v){
            u = root(u);
            v = root(v);
            if(u == v) return false;
            if(lab[u] > lab[v]) swap(u, v);
            lab[u] += lab[v];
            lab[v] = u;
            return true;
      }
};

const int MAX = 1e4 + 5;

int depth[MAX], par[MAX], max_depth[MAX], timer_dfs, c[MAX];
vi adj[MAX];

void dfs(int u, int p){
      max_depth[u] = depth[u];
      for(auto v : adj[u]) if(v != p){
            par[v] = u;
            depth[v] = depth[u] + 1;
            dfs(v, u);
            maximize(max_depth[u], max_depth[v]);
      }
}

long long Ioi(int N, int M, int A[], int B[], int P, int V, int T) {
      DSU dsu(N);
      FOR(i, 0, M){
            if(dsu.join(A[i], B[i])){
                  adj[A[i]].pb(B[i]);
                  adj[B[i]].pb(A[i]);
            }
      }

      dfs(0, -1);

      ll X = 0;

      if(max_depth[0] >= 59){
            if(depth[P] >= 59){
                  X |= (1LL << (depth[P] % 60)) * V;
                  FOR(i, 1, 59){
                        P = par[P];
                        int nxt = Move(P);
                        X |= (1LL << (depth[P] % 60)) * nxt);
                  }
                  return X;
            } else{
                  stack<int> to_root;

                  X |= (1LL << depth[P]) * V;
                  int base = P;
                  while(P != 0){
                        to_root.push(P);
                        P = par[P];
                        int nxt = Move(P);
                        X |= (1LL << depth[P]) * V;
                  }

                  while(!to_root.empty()){
                        P = to_root.top(); to_root.pop();
                        Move(P);
                  }

                  assert(P == base);
                  int had = depth[P];
                  
                  FOR(i, had, 60){
                        
                  }
            }
      }

      return 0ll;
}

Compilation message (stderr)

# 1번째 컴파일 단계

Joi.cpp:10:12: error: 'pair' does not name a type
   10 | using pi = pair<int, int>;
      |            ^~~~
Joi.cpp:11:12: error: 'pair' does not name a type
   11 | using pl = pair<ll, ll>;
      |            ^~~~
Joi.cpp:13:12: error: 'vector' does not name a type
   13 | using vi = vector<int>;
      |            ^~~~~~
Joi.cpp:14:12: error: 'vector' does not name a type
   14 | using vl = vector<ll>;
      |            ^~~~~~
Joi.cpp:15:12: error: 'vector' does not name a type
   15 | using vc = vector<char>;
      |            ^~~~~~
Joi.cpp:16:12: error: 'vector' does not name a type
   16 | using vb = vector<bool>;
      |            ^~~~~~
Joi.cpp:18:20: error: 'pi' was not declared in this scope
   18 | using vpi = vector<pi>;
      |                    ^~
Joi.cpp:18:20: error: 'pi' was not declared in this scope
Joi.cpp:18:20: error: 'pi' was not declared in this scope
Joi.cpp:18:20: error: 'pi' was not declared in this scope
Joi.cpp:18:20: error: 'pi' was not declared in this scope
Joi.cpp:18:20: error: 'pi' was not declared in this scope
Joi.cpp:18:13: error: 'vector' does not name a type
   18 | using vpi = vector<pi>;
      |             ^~~~~~
Joi.cpp:19:20: error: 'pl' was not declared in this scope; did you mean 'll'?
   19 | using vpl = vector<pl>;
      |                    ^~
      |                    ll
Joi.cpp:19:20: error: 'pl' was not declared in this scope; did you mean 'll'?
   19 | using vpl = vector<pl>;
      |                    ^~
      |                    ll
Joi.cpp:19:20: error: 'pl' was not declared in this scope; did you mean 'll'?
   19 | using vpl = vector<pl>;
      |                    ^~
      |                    ll
Joi.cpp:19:20: error: 'pl' was not declared in this scope; did you mean 'll'?
   19 | using vpl = vector<pl>;
      |                    ^~
      |                    ll
Joi.cpp:19:20: error: 'pl' was not declared in this scope; did you mean 'll'?
   19 | using vpl = vector<pl>;
      |                    ^~
      |                    ll
Joi.cpp:19:20: error: 'pl' was not declared in this scope; did you mean 'll'?
   19 | using vpl = vector<pl>;
      |                    ^~
      |                    ll
Joi.cpp:19:13: error: 'vector' does not name a type
   19 | using vpl = vector<pl>;
      |             ^~~~~~
Joi.cpp:22:7: error: 'vi' does not name a type; did you mean 'void'?
   22 |       vi lab;
      |       ^~
      |       void
Joi.cpp: In constructor 'DSU::DSU(int)':
Joi.cpp:23:20: error: class 'DSU' does not have any field named 'lab'
   23 |       DSU(int n) : lab(n, -1) {}
      |                    ^~~
Joi.cpp: In member function 'int DSU::root(int)':
Joi.cpp:26:20: error: 'lab' was not declared in this scope
   26 |             return lab[u] < 0 ? u : (lab[u] = root(lab[u]));
      |                    ^~~
Joi.cpp: In member function 'bool DSU::join(int, int)':
Joi.cpp:33:16: error: 'lab' was not declared in this scope
   33 |             if(lab[u] > lab[v]) swap(u, v);
      |                ^~~
Joi.cpp:33:33: error: 'swap' was not declared in this scope
   33 |             if(lab[u] > lab[v]) swap(u, v);
      |                                 ^~~~
Joi.cpp:34:13: error: 'lab' was not declared in this scope
   34 |             lab[u] += lab[v];
      |             ^~~
Joi.cpp: At global scope:
Joi.cpp:43:1: error: 'vi' does not name a type; did you mean 'void'?
   43 | vi adj[MAX];
      | ^~
      | void
Joi.cpp: In function 'void dfs(int, int)':
Joi.cpp:47:20: error: 'adj' was not declared in this scope
   47 |       for(auto v : adj[u]) if(v != p){
      |                    ^~~
Joi.cpp:51:13: error: 'maximize' was not declared in this scope
   51 |             maximize(max_depth[u], max_depth[v]);
      |             ^~~~~~~~
Joi.cpp: In function 'void dfs_mark(int, int, ll)':
Joi.cpp:57:20: error: 'adj' was not declared in this scope
   57 |       for(auto v : adj[u]) if(v != p){
      |                    ^~~
Joi.cpp: In function 'void dfs_cover(int, int, ll)':
Joi.cpp:65:20: error: 'adj' was not declared in this scope
   65 |       for(auto v : adj[u]) if(v != p){
      |                    ^~~
Joi.cpp: In function 'void Joi(int, int, int*, int*, long long int, int)':
Joi.cpp:72:11: error: 'i' was not declared in this scope
   72 |       FOR(i, 0, M){
      |           ^
Joi.cpp:72:7: error: 'FOR' was not declared in this scope
   72 |       FOR(i, 0, M){
      |       ^~~
Joi.cpp:80:7: error: 'fill' was not declared in this scope
   80 |       fill(c, c + N, -1);
      |       ^~~~
Joi.cpp:82:20: error: 'u' was not declared in this scope
   82 |       if(max_depth[u] >= 59){
      |                    ^