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];
for(int i = 1; i < n; ++i) {
if(ptc[i] == 0 || ptc[i] == 2) {
v[i].push_back(hst[i]);
}
if(ptc[i] == 1 || ptc[i] == 2) {
for(int x : v[hst[i]]) {
v[i].push_back(x);
}
}
}
for(int b = 1; b < (1 << n); ++b) {
bool ms = 1;
int x = 0;
for(int i = 0; i < n; ++i) {
if(b & (1 << i)) {
x += cfd[i];
for(int y : v[i]) {
if(b & (1 << y)) {
ms = 0;
break;
}
}
}
if(!ms) break;
}
if(ms) 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... |