#include <bits/stdc++.h>
#include "Joi.h"
#define f first
#define s second
using namespace std;
typedef long long int;
const int jZ = 1e4+5;
vector<int> jadj[jZ], jG[jZ];
int jdisc[jZ], jt[jZ], jcn, jn, jrqm, jC = 60;
void jDFS(int u, int 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);
jn = 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);
for(int i=0; i<jn; i++) cout << given_msg[i] << " ";
cout << endl;
cout << endl;
}
#include <bits/stdc++.h>
#include "Ioi.h"
using namespace std;
typedef long long int;
const int Z = 1e4+5;
vector<int> adj[Z], G[Z];
int disc[Z], t[Z], cn, n, f, cur, C = 60, rqm, msg[Z], sub[Z], par[Z];
void DFS(int u, int p)
{
disc[u] = cn;
t[cn] = u;
cn++;
sub[u] = 1;
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 ;
if(u == cur) f = 1;
for(int v : G[u])
{
if(v == p) continue;
if(f) msg[v] = Move(v);
dfs(v, u);
}
if(p != -1) msg[p] = Move(p);
C--;
}
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++)
// {
// for(int v : G[i]) cout << v << " ";
// cout << endl;
// }
dfs(0, -1);
int 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]);
}
return ret;
}
Compilation message
Joi.cpp:7:19: error: declaration does not declare anything [-fpermissive]
typedef long long int;
^~~
Joi.cpp:10:29: error: 'int jn' redeclared as different kind of symbol
int jdisc[jZ], jt[jZ], jcn, jn, jrqm, jC = 60;
^~
In file included from /usr/include/features.h:367:0,
from /usr/include/x86_64-linux-gnu/c++/7/bits/os_defines.h:39,
from /usr/include/x86_64-linux-gnu/c++/7/bits/c++config.h:533,
from /usr/include/c++/7/cassert:43,
from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:33,
from Joi.cpp:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:249:1: note: previous declaration 'double jn(int, double)'
__MATHCALL (jn,, (int, _Mdouble_));
^
Joi.cpp: In function 'void Joi(int, int, int*, int*, long long int, int)':
Joi.cpp:29:7: error: assignment of function 'double jn(int, double)'
jn = N, jrqm = X;
^
Joi.cpp:29:7: error: cannot convert 'int' to 'double(int, double) throw ()' in assignment
Joi.cpp:35:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
for(int i=0; i<jn; i++) cout << given_msg[i] << " ";
^~
Joi.cpp:35:34: error: 'given_msg' was not declared in this scope
for(int i=0; i<jn; i++) cout << given_msg[i] << " ";
^~~~~~~~~
Ioi.cpp:4:19: error: declaration does not declare anything [-fpermissive]
typedef long long int;
^~~