This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#include <bits/stdc++.h>
using namespace std;
#define sqr 200
#define mid (l+r)/2
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define ins insert
#define era erase
#define C continue
#define mem(dp,i) memset(dp,i,sizeof(dp))
#define mset multiset
typedef long long ll;
typedef short int si;
typedef long double ld;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
const ll mod=1e9+7;
const ll inf= 4e18;
const ld pai=acos(-1);
#include "friend.h"
int adj[19][19];
int check(vi v){
for(int i=0;i<v.size();i++){
for(int j=i+1;j<v.size();j++){
int a=v[i];
int b=v[j];
if(adj[a][b])return 0;
}
}
return 1;
}
int findSample(int n,int confidence[],int host[],int protocol[]){
for(int i=1;i<n;i++){
int t=protocol[i];
int j=host[i];
if(t==0){
adj[i][j]=adj[j][i]=1;
C;
}
for(int k=0;k<n;k++){
if(adj[j][k])adj[i][k]=adj[k][i]=1;
}
if(t==2)adj[i][j]=adj[j][i]=1;
}
int ans=0;
for(int mask=0;mask<(1<<n);mask++){
vi ret;
int sum=0;
for(int i=0;i<n;i++){
if( (mask&(1<<i)) ) ret.pb(i) , sum+=confidence[i];
}
if(check(ret))ans=max(ans,sum);
}
return ans;
}
Compilation message (stderr)
friend.cpp: In function 'int check(vi)':
friend.cpp:32:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=0;i<v.size();i++){
~^~~~~~~~~
friend.cpp:33:36: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int j=i+1;j<v.size();j++){
~^~~~~~~~~
# | 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... |