제출 #1064304

#제출 시각아이디문제언어결과실행 시간메모리
1064304damjandavkov친구 (IOI14_friend)C++17
11 / 100
1065 ms65536 KiB
#include "friend.h" #include <bits/stdc++.h> using namespace std; int findSample(int n, int v[], int pa[], int ty[]) { vector<vector<bool> > vg(n, vector<bool>(n, 0)); int i, j, k, s, ms = 0; for (i = 1; i < n; i++) { k = pa[i]; if (ty[i] != 1) vg[i][k] = vg[k][i] = 1; if (ty[i]) { for (j = 0; j < i; j++) { if (vg[j][k]) vg[i][j] = vg[j][i] = 1; } } } for (i = 0; i < (1 << n); i++) { s = 0; for (j = 0; j < n; j++) { if (i & (1 << j)) s += v[j]; } for (j = 0; j < n; j++) { for (k = 0; k < n; k++) { if ((i & (1 << j)) && (i & (1 << k)) && vg[j][k]) s = 0; } } ms = max(ms, s); } return ms; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...