Submission #297588

# Submission time Handle Problem Language Result Execution time Memory
297588 2020-09-11T16:11:01 Z infinite_iq Split the Attractions (IOI19_split) C++14
11 / 100
122 ms 10744 KB
#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

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 time Memory Grader output
1 Correct 2 ms 2688 KB ok, correct split
2 Correct 2 ms 2688 KB ok, correct split
3 Correct 2 ms 2688 KB ok, correct split
4 Incorrect 2 ms 2688 KB invalid split: #1=1, #2=1, #3=2
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2720 KB ok, correct split
2 Correct 2 ms 2688 KB ok, correct split
3 Correct 2 ms 2688 KB ok, correct split
4 Correct 103 ms 8952 KB ok, correct split
5 Correct 93 ms 8568 KB ok, correct split
6 Correct 73 ms 7928 KB ok, correct split
7 Correct 79 ms 10744 KB ok, correct split
8 Correct 122 ms 10744 KB ok, correct split
9 Correct 75 ms 8440 KB ok, correct split
10 Correct 58 ms 8944 KB ok, correct split
11 Correct 61 ms 9072 KB ok, correct split
12 Correct 58 ms 8944 KB ok, correct split
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2688 KB invalid split: #1=1, #2=1, #3=3
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 2688 KB invalid split: #1=1, #2=2, #3=6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2688 KB ok, correct split
2 Correct 2 ms 2688 KB ok, correct split
3 Correct 2 ms 2688 KB ok, correct split
4 Incorrect 2 ms 2688 KB invalid split: #1=1, #2=1, #3=2
5 Halted 0 ms 0 KB -