Submission #139538

#TimeUsernameProblemLanguageResultExecution timeMemory
139538Mahmoud_AdelAmusement Park (JOI17_amusement_park)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "Joi.h" #define f first #define s second using namespace std; typedef long long ll; const int jZ = 1e4+5; vector<ll> jadj[jZ], jG[jZ]; ll jdisc[jZ], jt[jZ], jcn, n, jrqm, jC = 60; void jDFS(ll u, ll p) { jdisc[u] = jcn; jt[jcn] = u; MessageBoard(u, (jrqm>>(jcn%jC))&1); //cout << u << " " << jadj[u].size() << endl; jcn++; for(int v : jadj[u]) { //cout << v << " " << jdisc[v] << endl; if(v == p || jdisc[v] != -1) continue; jDFS(v, u); } if(p != -1) jG[u].push_back(p), jG[p].push_back(u); } void Joi(int N, int M, int A[], int B[], long long X, int T) { memset(jdisc, -1, sizeof jdisc); n = N, jrqm = X; for(int i=0; i<M; i++) { jadj[A[i]].push_back(B[i]), jadj[B[i]].push_back(A[i]); } jDFS(0, -1); }
#include <bits/stdc++.h> #include "Ioi.h" using namespace std; const int Z = 1e4+5; vector<ll> adj[Z], G[Z]; ll disc[Z], t[Z], cn, n, f, cur, C = 60, l, r, rqm, msg[Z], sub[Z], par[Z]; void DFS(ll u, ll p) { disc[u] = cn; t[cn] = u; cn++; sub[u] = 1; par[u] = p; for(int v : adj[u]) { if(v == p || disc[v] != -1) continue; DFS(v, u), sub[u] += sub[v]; } if(p != -1) G[u].push_back(p), G[p].push_back(u); } void dfs(int u, int p) { if(!C) return ; C--; for(int v : G[u]) { if(v == p || v == par[u]) continue; msg[v] = Move(v); dfs(v, u); Move(u); } } void operate() { dfs(cur, par[cur]); while(C) { msg[par[cur]] = Move(par[cur]), C--; dfs(par[cur], cur); cur = par[cur]; } } long long Ioi(int N, int M, int A[], int B[], int P, int V, int T) { memset(disc, -1, sizeof disc); memset(msg, -1, sizeof msg); n = N, cur = P, msg[cur] = V; for(int i=0; i<M; i++) adj[A[i]].push_back(B[i]), adj[B[i]].push_back(A[i]); DFS(0, -1); // for(int i=0; i<n; i++) // { // cout << i << " : "; // for(int v : G[i]) cout << v << " "; // cout << endl; // } operate(); ll ret = 0; C = 60; for(int i=0; i<n; i++) { if(msg[i] == -1) continue; int bit = i%C; ret |= ((1<<bit)*msg[i]); //cout << msg[i] << " " << ret << " " << bit << endl; } return ret; }

Compilation message (stderr)

Ioi.cpp:5:8: error: 'll' was not declared in this scope
 vector<ll> adj[Z], G[Z];
        ^~
Ioi.cpp:5:10: error: template argument 1 is invalid
 vector<ll> adj[Z], G[Z];
          ^
Ioi.cpp:5:10: error: template argument 2 is invalid
Ioi.cpp:6:1: error: 'll' does not name a type
 ll disc[Z], t[Z], cn, n, f, cur, C = 60, l, r, rqm, msg[Z], sub[Z], par[Z];
 ^~
Ioi.cpp:7:10: error: variable or field 'DFS' declared void
 void DFS(ll u, ll p)
          ^~
Ioi.cpp:7:10: error: 'll' was not declared in this scope
Ioi.cpp:7:16: error: 'll' was not declared in this scope
 void DFS(ll u, ll p)
                ^~
Ioi.cpp: In function 'void dfs(int, int)':
Ioi.cpp:23:6: error: 'C' was not declared in this scope
  if(!C) return ;
      ^
Ioi.cpp:24:2: error: 'C' was not declared in this scope
  C--;
  ^
Ioi.cpp:25:17: error: 'begin' was not declared in this scope
  for(int v : G[u])
                 ^
Ioi.cpp:25:17: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:95:0,
                 from Ioi.cpp:1:
/usr/include/c++/7/valarray:1211:5: note:   'std::begin'
     begin(const valarray<_Tp>& __va)
     ^~~~~
/usr/include/c++/7/valarray:1211:5: note:   'std::begin'
Ioi.cpp:25:17: error: 'end' was not declared in this scope
  for(int v : G[u])
                 ^
Ioi.cpp:25:17: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:95:0,
                 from Ioi.cpp:1:
/usr/include/c++/7/valarray:1231:5: note:   'std::end'
     end(const valarray<_Tp>& __va)
     ^~~
/usr/include/c++/7/valarray:1231:5: note:   'std::end'
Ioi.cpp:27:21: error: 'par' was not declared in this scope
   if(v == p || v == par[u]) continue;
                     ^~~
Ioi.cpp:28:3: error: 'msg' was not declared in this scope
   msg[v] = Move(v);
   ^~~
Ioi.cpp: In function 'void operate()':
Ioi.cpp:35:6: error: 'cur' was not declared in this scope
  dfs(cur, par[cur]);
      ^~~
Ioi.cpp:35:11: error: 'par' was not declared in this scope
  dfs(cur, par[cur]);
           ^~~
Ioi.cpp:36:8: error: 'C' was not declared in this scope
  while(C)
        ^
Ioi.cpp:38:3: error: 'msg' was not declared in this scope
   msg[par[cur]] = Move(par[cur]), C--;
   ^~~
Ioi.cpp: In function 'long long int Ioi(int, int, int*, int*, int, int, int)':
Ioi.cpp:45:9: error: 'disc' was not declared in this scope
  memset(disc, -1, sizeof disc);
         ^~~~
Ioi.cpp:45:9: note: suggested alternative: 'dfs'
  memset(disc, -1, sizeof disc);
         ^~~~
         dfs
Ioi.cpp:46:9: error: 'msg' was not declared in this scope
  memset(msg, -1, sizeof msg);
         ^~~
Ioi.cpp:47:2: error: 'n' was not declared in this scope
  n = N, cur = P, msg[cur] = V;
  ^
Ioi.cpp:47:9: error: 'cur' was not declared in this scope
  n = N, cur = P, msg[cur] = V;
         ^~~
Ioi.cpp:49:13: error: request for member 'push_back' in 'adj[(*(A + ((sizetype)(((long unsigned int)i) * 4))))]', which is of non-class type 'int'
   adj[A[i]].push_back(B[i]), adj[B[i]].push_back(A[i]);
             ^~~~~~~~~
Ioi.cpp:49:40: error: request for member 'push_back' in 'adj[(*(B + ((sizetype)(((long unsigned int)i) * 4))))]', which is of non-class type 'int'
   adj[A[i]].push_back(B[i]), adj[B[i]].push_back(A[i]);
                                        ^~~~~~~~~
Ioi.cpp:51:2: error: 'DFS' was not declared in this scope
  DFS(0, -1);
  ^~~
Ioi.cpp:59:2: error: 'll' was not declared in this scope
  ll ret = 0;
  ^~
Ioi.cpp:60:2: error: 'C' was not declared in this scope
  C = 60;
  ^
Ioi.cpp:65:3: error: 'ret' was not declared in this scope
   ret |= ((1<<bit)*msg[i]);
   ^~~
Ioi.cpp:68:9: error: 'ret' was not declared in this scope
  return ret;  
         ^~~
Ioi.cpp:68:9: note: suggested alternative: 'getw'
  return ret;  
         ^~~
         getw