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;
#define sz(a) ((int)(a).size())
typedef vector<int> vint;
typedef vector<vint> vvint;
#ifndef wambule
#include "friend.h"
#else
#endif
int findSample(int n, int cfd[], int hst[], int ptc[]) {
int dr = 0;
vector<int> v[n];
vector<pair<int, int>> u;
for(int i = 1; i < n; ++i) {
if(ptc[i]) {
for(int x : v[hst[i]]) {
v[i].push_back(x);
v[x].push_back(i);
u.push_back({i, x});
}
}
if(ptc[i] ^ 1) {
v[i].push_back(hst[i]);
v[hst[i]].push_back(i);
u.push_back({i, hst[i]});
}
}
for(int b = 1; b < (1 << n); ++b) {
bool ms = 1;
int x = 0;
for(int i = 0; i < sz(u); ++i) {
if((b & (1 << u[i].first)) && (b & (1 << u[i].second))) {
ms = 0;
break;
}
}
if(!ms) continue;
for(int i = 0; i < n; ++i) {
if(b & (1 << i)) {
x += cfd[i];
}
}
dr = max(dr, x);
}
return dr;
}
#ifdef wambule
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
return 0;
}
#endif
# | 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... |