# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
139516 | 2019-07-31T23:29:25 Z | MohamedAhmed04 | Amusement Park (JOI17_amusement_park) | C++14 | 0 ms | 0 KB |
#include <bits/stdc++.h> #include "Joi.h" //#include "grader.cpp" //#include "Ioi.cpp" using namespace std ; const int _MAX = 10005 ; int _vis[_MAX] ; int _cnt = 0 ; long long _x ; vector< vector<int> >_adj(_MAX) ; void dfss(int node) { _vis[node] = 1 ; int assign ; if(_cnt >= 60) assign = 0 ; else assign = (_x & (1ll << _cnt)) ; if(assign) assign = 1 ; _cnt++ ; MessageBoard(node , assign) ; for(auto &child : _adj[node]) { if(_vis[child]) continue ; dfss(child) ; } return ; } void Joi(int N, int M, int A[], int B[], long long x, int T) { _x = X ; srand(123321) ; for(int i = 0 ; i < M ; ++i) { _adj[A[i]].push_back(B[i]) ; _adj[B[i]].push_back(A[i]) ; } for(int i = 0 ; i < N ; ++i) sort(_adj[i].begin() , _adj[i].end()) ; for(int i = 0 ; i < N ; ++i) random_shuffle(_adj[i].begin() , _adj[i].end()) ; int node = rand() % N ; dfss(node) ; return ; }