# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
296305 | arayi | Friend (IOI14_friend) | C++17 | 1092 ms | 5088 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"
#define ad push_back
using namespace std;
const int N = 1010;
vector <int> g[N];
bool col[20][20];
int findSample(int n,int c[],int host[],int pr[])
{
bool mk, erk, erq;
mk=erk=erq=0;
for (int i = 1; i < n; i++)
{
if(pr[i] == 0)
{
g[host[i]].ad(i);
g[i].ad(host[i]);
mk = 1;
}
else if(pr[i] == 1)
{
for(auto p : g[host[i]]) g[p].ad(i), g[i].ad(p);
erk = 1;
}
else
{
for(auto p : g[host[i]]) g[p].ad(i), g[i].ad(p);
g[host[i]].ad(i);
g[i].ad(host[i]);
erq = 1;
}
}
if(n <= 10)
{
for (int i = 0; i < n; i++)
for(auto p : g[i]) col[i][p] = 1;//, cout << i << " " << p << endl;
int pat = 0;
for(int x = 0; x < (1 << n); ++x)
{
int sum = 0;
vector <int> sm;
for (int i = 0; i < n; i++)
if(x & (1 << i)) sum += c[i], sm.ad(i);
bool bl = 0;
for(auto p : sm)
for(auto p1 : sm) if(col[p][p1]) bl = true;
if(!bl) pat = max(pat, sum);
}
return pat;
}
}
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... |