제출 #297565

#제출 시각아이디문제언어결과실행 시간메모리
297565infinite_iqSplit the Attractions (IOI19_split)C++14
0 / 100
7 ms5120 KiB
#include <bits/stdc++.h> using namespace std; #define pb push_back #define C continue typedef vector < int > vi ; #include "split.h" int n , m , timer ; vi v [100009] ; int ord [100009] , done [100009] ; void dfs ( int node , int p ) { done [node] = 1 ; ord [timer++] = node ; if ( timer == n ) return ; for ( auto u : v [node] ) { if ( u == p || done [u] ) C ; dfs ( u , node ) ; } } vi find_split ( int N , int sz1 , int sz2 , int sz3 , vi p , vi q ) { n = N , m = p .size () ; for ( int i = 0 ; i < n ; i ++ ) { int a = p [i] , b = q [i] ; v [a] .pb ( b ) ; v [b] .pb ( a ) ; } dfs ( 0 , 0 ) ; vi ret ( n , 0 ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( i < sz1 ) { ret [ord[i]] = 1 ; } else if ( i < sz1 + sz2 ) { ret [ord[i]] = 2 ; } else { ret [ord[i]] = 3 ; } } return ret ; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...