Submission #297588

#TimeUsernameProblemLanguageResultExecution timeMemory
297588infinite_iqSplit the Attractions (IOI19_split)C++14
11 / 100
122 ms10744 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 , goal ; vi v [100009] , ret ; int done [100009] ; void dfs ( int node ) { if ( ret .size () == goal ) return ; done [node] = 1 ; ret .pb ( node ) ; for ( auto u : v [node] ) { if ( done [u] ) C ; dfs ( u ) ; } } vi find_split ( int N , int sz1 , int sz2 , int sz3 , vi p , vi q ) { n = N , m = p .size () , goal = sz2 ; for ( int i = 0 ; i < m ; i ++ ) { int a , b ; a = p [i] , b = q [i] ; v [a] .pb ( b ) ; v [b] .pb ( a ) ; } dfs ( 0 ) ; vi ans ( n , 0 ) ; for ( auto u : ret ) { ans [u] = 2 ; } for ( auto &u : ans ) { if ( ! u ) { u = 1 ; break ; } } for ( auto &u : ans ) { if ( ! u ) { u = 3 ; } } return ans ; }

Compilation message (stderr)

split.cpp: In function 'void dfs(int)':
split.cpp:11:27: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   11 |         if ( ret .size () == goal ) return ;
      |              ~~~~~~~~~~~~~^~~~~~~
#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...