Submission #68856

# Submission time Handle Problem Language Result Execution time Memory
68856 2018-08-18T20:03:41 Z duality Amusement Park (JOI17_amusement_park) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
typedef long long int LLI;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vpii;
#include "Joi.h"

static int parent[10000];
int find(int n) {
    if (parent[n] != n) parent[n] = find(parent[n]);
    return parent[n];
}
static vi adjList[10000];
static int key[10000],nxt[10000];
static int message[10000];
static int doDFS(int u,int p) {
    int i;
    int m = 0,mv = -1;
    for (i = 0; i < adjList[u].size(); i++) {
        int v = adjList[u][i];
        if (v != p) {
            int r = doDFS(v,u);
            if (r+1 > m) m = r+1,mv = v;
        }
    }
    nxt[u] = mv;
    if (m == 60) {
        key[u] = 1;
        return 0;
    }
    else return m;
}
static int num = 0;
static int doDFS2(int u,int p,LLI X) {
    int i;
    if (num < 60) {
        MessageBoard(u,((X & (1LL << num)) > 0));
        message[u] = 1;
    }
    num++;
    for (i = 0; i < adjList[u].size(); i++) {
        int v = adjList[u][i];
        if (v != p) doDFS2(v,u,X);
    }
    return 0;
}
void Joi(int N,int M,int A[],int B[],long long int X,int T) {
    int i;
    for (i = 0; i < N; i++) parent[i] = i;
    for (i = 0; i < M; i++) {
        int pa = find(A[i]),pb = find(B[i]);
        if (pa != pb) {
            parent[pa] = pb;
            adjList[A[i]].pb(B[i]);
            adjList[B[i]].pb(A[i]);
        }
    }
    int j,f = 0;
    doDFS(0,-1);
    /*for (i = 0; i < N; i++) {
        if (key[i]) {
            int u = i;
            for (j = 0; j < 60; j++) {
                MessageBoard(u,((X & (1LL << j)) > 0));
                message[u] = 1;
                u = nxt[u];
            }
            f = 1;
        }
    }*/
    f = 0;
    if (!f) doDFS2(0,-1,X);
    for (i = 0; i < N; i++) {
        if (!message[i]) MessageBoard(i,0);
    }
}



    

Compilation message

Joi.cpp: In function 'int doDFS(int, int)':
Joi.cpp:22:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (i = 0; i < adjList[u].size(); i++) {
                 ~~^~~~~~~~~~~~~~~~~~~
Joi.cpp: In function 'int doDFS2(int, int, LLI)':
Joi.cpp:44:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (i = 0; i < adjList[u].size(); i++) {
                 ~~^~~~~~~~~~~~~~~~~~~
Joi.cpp: In function 'void Joi(int, int, int*, int*, long long int, int)':
Joi.cpp:61:9: warning: unused variable 'j' [-Wunused-variable]
     int j,f = 0;
         ^

/tmp/ccSwNSC5.o: In function `main':
grader_ioi.cpp:(.text.startup+0x36a): undefined reference to `Ioi(int, int, int*, int*, int, int, int)'
collect2: error: ld returned 1 exit status