# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
293565 | Badrangiikh | Friend (IOI14_friend) | C++14 | 1034 ms | 5112 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
int x , y , a [ 45 ] , 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 ) ;
}
if ( protocol [ i ] == 1 ) {
for ( int j = 0 ; j < vec [ host [ i ] ] . size ( ) ; j ++ ) {
vec [ i ] . push_back ( vec [ host [ i ] ] [ j ] ) ;
vec [vec [ host[ i ] ][ j ] ] . push_back ( i ) ;
}
}
if ( protocol [ i ] == 2 ) {
for ( int j = 0 ; j < vec [ host [ i ] ] . size ( ) ; j ++ ) {
vec [ i ] . push_back ( vec [ host [ i ] ] [ j ] ) ;
vec [ vec [ host[ i ] ][ j ] ] . push_back ( i ) ;
}
vec [ i ] . push_back ( host [ i ] ) ;
vec [ host [ i ] ] . push_back ( i ) ;
}
}
for ( int i = 1 ; i <= 2048 ; 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 ] == 1 && a [ l ] == 1 ) {
for ( int k = 0 ; k < vec [ j ] . size ( ) ; k ++ ) {
if ( vec [ j ] [ k ] == l ){
flag = false ;
}
}
}
}
}
if ( flag == true ) {
maxx = max ( maxx , y ) ;
}
}
return maxx ;
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |