제출 #1232052

#제출 시각아이디문제언어결과실행 시간메모리
1232052kl0989e친구 (IOI14_friend)C++20
11 / 100
15 ms1604 KiB
#include "friend.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define pi pair<int, int> #define pl pair<ll, ll> #define vi vector<int> #define vl vector<ll> #define fi first #define se second #define pb push_back #define all(x) (x).begin(),(x).end() const int maxn=10; vector<vi> graph(maxn,vi(maxn,0)); int findSample(int n, int val[],int host[],int prot[]) {// sub1 for (int i=1; i<n; i++) { if (prot[i]==0 || prot[i]==2) { graph[i][host[i]]=1; graph[host[i]][i]=1; } if (prot[i]) { for (int j=0; j<n; j++) { graph[i][j]|=graph[host[i]][j]; graph[j][i]|=graph[host[i]][j]; } } } int mx=0; for (int i=0; i<(1<<n); i++) { bool ok=1; for (int j=0; j<n && ok; j++) { for (int k=j+1; k<n && ok; k++) { if ((i&(1<<j)) && (i&(1<<k)) && graph[j][k]) { ok=0; } } } if (ok) { int cur=0; for (int j=0; j<n; j++) { if (i&(1<<j)) { cur+=val[j]; } } mx=max(mx,cur); } } return mx; } /*int findSample(int n, int val[],int host[],int prot[]) {// sub2 }*/ /*int findSample(int n, int val[],int host[],int prot[]) {// sub3 return *max_element(val,val+n); }*/ /*int findSample(int n, int val[],int host[],int prot[]) {// sub4 }*/
#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...