Submission #293494

#TimeUsernameProblemLanguageResultExecution timeMemory
293494BadrangiikhFriend (IOI14_friend)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; int x , y , a [ 45 ] , b [ 15 ] [ 15 ] , maxx , flag ; vector < int > vec [ 1005 ] ; int findSample ( int N , int confidence[] , int host[] , int protocol[] ) { if ( N <= 10 ) { maxx = 0 ; for ( int i = 1 ; i < N ; i ++ ) { if ( protocol [ i ] == 0 ) { vec [ i ] . push_back ( host [ i ] ) ; vec [ host [ i ] ] . push_back ( i ) ; b [ i ] [ host [ i ] ] = 1 ; b [ host [ i ] ] [ i ] = 1 ; } if ( protocol [ i ] == 1 ) { for ( int j = 0 ; j < vec [ host [ i ] ] . size ( ) ; j ++ ) { vec [ i ] . push_back ( vec [ host [ i ] ] [ j ] ) ; vec [ host [ i ] ] [ j ] . push_back ( i ) ; b [ i ] [ vec [ host [ i ] ] [ j ] ] = 1 ; b [ vec [ host [ i ] ] [ j ] ] [ i ] = 1 ; } } if ( protocol [ i ] == 2 ) { for ( int j = 0 ; j < vec [ host [ i ] ] . size ( ) ; j ++ ) { vec [ i ] . push_back ( vec [ host [ i ] ] [ j ] ) ; vec [ host [ i ] ] [ j ] . push_back ( i ) ; b [ i ] [ vec [ host [ i ] ] [ j ] ] = 1 ; b [ vec [ host [ i ] ] [ j ] ] [ i ] = 1 ; } vec [ i ] . push_back ( host [ i ] ) ; vec [ host [ i ] ] . push_back ( i ) ; b [ i ] [ host [ i ] ] = 1 ; b [ host [ i ] ] [ i ] = 1 ; } } for ( int i = 1 ; i < 1024 ; i ++ ) { x = i ; y = 0 ; flag = true ; for ( int j = 0 ; j <= 9 ; j ++ ) { a [ j ] = x % 2 ; x /= 2 ; if ( a [ j ] == 1 ) { y += confidence [ j ] ; } } for ( int j = 0 ; j <= 9 ; j ++ ) { for ( int l = 0 ; l <= 9 ; l ++ ) { if ( a [ j ] + a [ l ] == 2 ) { if ( b [ j ] [ l ] == 1 ) { flag = false ; } } } } if ( flag == true ) { maxx = max ( maxx , y ) ; } } } }

Compilation message (stderr)

friend.cpp: In function 'int findSample(int, int*, int*, int*)':
friend.cpp:18:37: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |                 for ( int j = 0 ; j < vec [ host [ i ] ] . size ( ) ; j ++ ) {
      |                                   ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
friend.cpp:20:48: error: request for member 'push_back' in 'vec[(*(host + ((sizetype)(((long unsigned int)i) * 4))))].std::vector<int>::operator[](((std::vector<int>::size_type)j))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   20 |                     vec [ host [ i ] ] [ j ] . push_back ( i ) ;
      |                                                ^~~~~~~~~
friend.cpp:26:37: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |                 for ( int j = 0 ; j < vec [ host [ i ] ] . size ( ) ; j ++ ) {
      |                                   ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
friend.cpp:28:48: error: request for member 'push_back' in 'vec[(*(host + ((sizetype)(((long unsigned int)i) * 4))))].std::vector<int>::operator[](((std::vector<int>::size_type)j))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   28 |                     vec [ host [ i ] ] [ j ] . push_back ( i ) ;
      |                                                ^~~~~~~~~
friend.cpp:63:1: warning: no return statement in function returning non-void [-Wreturn-type]
   63 | }
      | ^