Submission #257836

#TimeUsernameProblemLanguageResultExecution timeMemory
257836BlagojceAmusement Park (JOI17_amusement_park)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define fr(i, n, m) for(int i = (n); i < (m); i ++) #define pb push_back #define st first #define nd second #define pq priority_queue #define all(x) begin(x), end(x) #include <time.h> #include <cmath> using namespace std; typedef long long ll; typedef long double ld; typedef pair<int,int> pii; const int i_inf = 1e9; const ll inf = 1e17; const ll mod = 1000000007; const ld eps = 1e-13; const ld pi = 3.14159265359; mt19937 _rand(time(NULL)); clock_t timer = clock(); const int mxn = 1e5; #include "Joi.h" /*int VAL[mxn]; void MessageBoard(int u, int val){ VAL[u] = val; return; }*/ int n, m; int a[mxn], b[mxn]; bool vis[mxn]; vector<int> g[mxn]; int itopos[mxn]; int temp_p = 0; int depth[mxn]; int mx_depth[mxn]; int best_child[mxn]; void dfs(int u){ itopos[u] = temp_p++; vis[u] = true; mx_depth[u] = depth[u]; best_child[u] = u; for(auto e : g[u]){ if(vis[e]) continue; depth[e] = depth[u] + 1; dfs(e); if(mx_depth[u] < mx_depth[e]){ mx_depth[u] = mx_depth[e]; best_child[u] = e; } } } int REM; int pos_to_mark; ll x; void dfs2(int u, int flag){ if(flag == 0){ if(x&(1LL<<pos_to_mark)) MessageBoard(u, 1); else MessageBoard(u, 0); ++pos_to_mark; } else{ if(REM > 0){ if(x&(1LL<<pos_to_mark)) MessageBoard(u, 1); else MessageBoard(u, 0); ++pos_to_mark; --REM; } else{ MessageBoard(u, 0); } } vis[u] = true; for(auto e : g[u]){ if(vis[e]) continue; if(e == best_child[u]){ dfs2(e, 0|flag); } else{ dfs2(e, 1|flag); } } } void Joi(int N, int M, int A[], int B[], long long X, int T) { n = N, m = M, x = X; fr(i, 0, m) a[i] = A[i], b[i] = B[i]; fr(i, 0, m){ g[a[i]].pb(b[i]); g[b[i]].pb(a[i]); } dfs(0); int mxd = 0; fr(i, 0, n) mxd = max(mxd, depth[i]); if(mxd < 59){ memset(vis, false, sizeof(vis)); REM = 60 - (mx_depth[0]+1); dfs2(0, 0); /*fr(i, 0, n){ if(X&(1LL<<(itopos[i]%60))) MessageBoard(i,1); else MessageBoard(i,0); }*/ } else{ fr(i, 0, n){ if(X&(1LL<<(depth[i]%60)))MessageBoard(i,1); else MessageBoard(i,0); } } }

Compilation message (stderr)

/tmp/ccd81HaB.o: In function `main':
grader_joi.cpp:(.text.startup+0x1ac): undefined reference to `Joi(int, int, int*, int*, long long, int)'
collect2: error: ld returned 1 exit status

Ioi.cpp: In function 'void dfs2(int, int)':
Ioi.cpp:65:28: error: 'MessageBoard' was not declared in this scope
   if(x&(1LL<<pos_to_mark)) MessageBoard(u, 1);
                            ^~~~~~~~~~~~
Ioi.cpp:66:8: error: 'MessageBoard' was not declared in this scope
   else MessageBoard(u, 0);
        ^~~~~~~~~~~~
Ioi.cpp:71:29: error: 'MessageBoard' was not declared in this scope
    if(x&(1LL<<pos_to_mark)) MessageBoard(u, 1);
                             ^~~~~~~~~~~~
Ioi.cpp:72:9: error: 'MessageBoard' was not declared in this scope
    else MessageBoard(u, 0);
         ^~~~~~~~~~~~
Ioi.cpp:77:4: error: 'MessageBoard' was not declared in this scope
    MessageBoard(u, 0);
    ^~~~~~~~~~~~
Ioi.cpp: In function 'void Joi(int, int, int*, int*, long long int, int)':
Ioi.cpp:116:30: error: 'MessageBoard' was not declared in this scope
    if(X&(1LL<<(depth[i]%60)))MessageBoard(i,1); 
                              ^~~~~~~~~~~~
Ioi.cpp:117:9: error: 'MessageBoard' was not declared in this scope
    else MessageBoard(i,0);
         ^~~~~~~~~~~~