Submission #297574

#TimeUsernameProblemLanguageResultExecution timeMemory
297574infinite_iqSplit the Attractions (IOI19_split)C++14
7 / 100
120 ms13304 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 < m ; 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...