# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1017962 | n3rm1n | Friend (IOI14_friend) | C++17 | 18 ms | 4208 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>
#define endl '\n'
#include "friend.h"
using namespace std;
long long ans = 0;
long long are[1005][1005], c[1005];
long long N, used[1005];
void check()
{
vector < int > g;
long long all = 0;
for (int i = 0; i < N; ++ i)
{
if(used[i])
{
g.push_back(i);
all += c[i];
}
}
for (int i = 0; i < g.size(); ++ i)
{
for (int j = i+1; j < g.size(); ++ j)
if(are[g[i]][g[j]])return;
}
ans = max(ans, all);
}
void gen(int pos)
{
if(pos == N)
{
check();
return;
}
used[pos] = 0;
gen(pos+1);
used[pos] = 1;
gen(pos+1);
}
int cntp[4];
int findSample(int n, int confidence[], int host[], int protocol[])
{
N = n;
for (int i = 0; i < n; ++ i)
cntp[protocol[i]] ++;
if(n <= 10)
{
c[0] = confidence[0];
for (int i = 1; i < n; ++ i)
{
c[i] = confidence[i];
if(protocol[i] == 0)
{
are[i][host[i]] = 1;
are[host[i]][i] = 1;
}
else
{
for (int j = 0; j < n; ++ j)
{
if(are[j][host[i]])
{
are[i][j] = 1;
are[j][i] = 1;
}
}
if(protocol[i] == 2)
{
are[i][host[i]] = 1;
are[host[i]][i] = 1;
}
}
}
gen(0);
return ans;
}
if(cntp[2] == n-1)
{
long long maxx = 0;
for (int i = 0; i < n; ++ i)
{
maxx = max(maxx, 1LL * confidence[i]);
}
return maxx;
}
}
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... |