Submission #293499

#TimeUsernameProblemLanguageResultExecution timeMemory
293499BadrangiikhFriend (IOI14_friend)C++14
0 / 100
314 ms65540 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 ] ] . 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 ] ] . 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 < N ; j ++ ) { a [ j ] = x % 2 ; x /= 2 ; if ( a [ j ] == 1 ) { y += confidence [ j ] ; } } for ( int j = 0 ; j < N ; j ++ ) { for ( int l = 0 ; l < N ; l ++ ) { if ( a [ j ] + a [ l ] == 2 ) { if ( b [ j ] [ l ] == 1 ) { flag = false ; } } } } if ( flag == true ) { maxx = max ( maxx , y ) ; } return maxx ; } } }

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: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:64:1: warning: control reaches end of non-void function [-Wreturn-type]
   64 | }
      | ^
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...