이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
}
컴파일 시 표준 에러 (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... |