# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
293499 | Badrangiikh | Friend (IOI14_friend) | C++14 | 314 ms | 65540 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 ] , 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)
# | 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... |