# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
918339 | contest_alt | Holiday (IOI14_holiday) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "friend.h"
#include <vector>
#include <algorithm>
#include <random>
const int MAXN = 1000;
namespace Solver {
std::vector<int> adj[MAXN];
void push_edge( int a, int b ) {
adj[a].push_back( b );
adj[b].push_back( a );
}
void make_graph( int n, int host[], int protocol[] ) {
for( int i = 1 ; i < n ; i++ ){
if( protocol[i] == 0 )
push_edge( i, host[i] );
else if( protocol[i] == 1 ){
for( int x : adj[host[i]] )
push_edge( x, i );
}else{
for( int x : adj[host[i]] )
push_edge( x, i );
push_edge( host[i], i );
}