# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
236996 | crossing0ver | Friend (IOI14_friend) | C++17 | 67 ms | 8312 KiB |
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>
#include "friend.h"
using namespace std;
const int MAXN = 1E5+5;
int n,val[MAXN];
vector<int> adj[MAXN];
int case1(){
int mxval = 0;
for (int i = 0; i < (1 << n); i++) {
vector<int> x;
x.clear();
for (int j = 0; j < n; j++) {
if ( (1 << j) & i)
x.push_back(j);
}
bool flag = 1;
for (int j:x) {
for (int k:x) {
for (int h : adj[j])
if (h == k) flag = 0;
}
}
if (flag) {
int s = 0;
for (int j:x) s += val[j];
mxval = max(mxval,s);
}
}
return mxval;
}
int findSample(int n1,int confidence[],int host[],int protocol[]){
n = n1;
int type[] = {1,1,1};
for (int i =0; i < n; i++) val[i] = confidence[i];
for (int i = 1; i < n; i++) {
int x = protocol[i];
int v = host[i];
for (int j =0; j< 3; j++) if (x != j ) type[j] = 0;
if (x == 0) {
adj[v].push_back(i);
adj[i].push_back(v);
}
else {
for (int f:adj[v]) adj[i].push_back(f);
if (x == 2) {
adj[i].push_back(v);
adj[v].push_back(i);
}
}
}
if (n <= 10) return case1();
return 1;
}
Compilation message (stderr)
# | 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... |