# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
520917 | peti1234 | Friend (IOI14_friend) | C++17 | 22 ms | 1432 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>
using namespace std;
int findSample(int n, int con[], int h[], int p[]) {
// 1
if (n<=10) {
bool el[10][10];
for (int i=0; i<n; i++) {
for (int j=0; j<n; j++) {
el[i][j]=0;
}
}
for (int i=1; i<=n-1; i++) {
if (p[i]==1 || p[i]==2) {
for (int j=0; j<n; j++) {
if (el[j][h[i]]) {
el[i][j]=1, el[j][i]=1;
}
}
}
if (p[i]==0 || p[i]==2) {
el[i][h[i]]=1, el[h[i]][i]=1;
}
}
int valasz=0;
for (int mask=0; mask<(1<<n); mask++) {
int ert=0;
for (int i=0; i<n; i++) {
if (mask & (1<<i)) {
ert+=con[i];
}
}
bool jo=1;
for (int i=0; i<n; i++) {
for (int j=0; j<n; j++) {
if ((mask & (1<<i)) && (mask & (1<<j)) && el[i][j]) {
jo=0;
}
}
}
if (jo) {
valasz=max(valasz, ert);
}
}
return valasz;
}
// 2
if (p[1]==2) {
int valasz=0;
for (int i=0; i<n; i++) {
valasz=max(valasz, con[i]);
}
return valasz;
}
// 3
if (p[1]==3) {
int valasz=0;
for (int i=0; i<n; i++) {
valasz+=con[i];
}
return valasz;
}
}
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... |