제출 #576132

#제출 시각아이디문제언어결과실행 시간메모리
576132elazarkoren친구 (IOI14_friend)C++17
19 / 100
24 ms4180 KiB
#include "friend.h" #include <bits/stdc++.h> #define x first #define y second #define all(v) v.begin(), v.end() #define chkmin(a, b) a = min(a, b) #define chkmax(a, b) a = max(a, b) using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int, int> pii; typedef vector<pii> vii; const int MAX_N = 1001; //vi graph[MAX_N]; int graph[MAX_N][MAX_N]; int findSample(int n, int confidence[], int host[], int protocol[]) { bool subtask2 = true; for (int i = 1; i < n; i++) { if (protocol[i] != 1) subtask2 = false; if (protocol[i]) { for (int j = 0; j < n; j++) { if (graph[host[i]][j]) { graph[i][j] = graph[j][i] = 1; } } } if (protocol[i] != 1) { graph[host[i]][i] = graph[i][host[i]] = 1; } } if (subtask2) { int s = 0; for (int i = 0; i < n; i++) { s += confidence[i]; } return s; } int ans = 0; for (int i = 0; i < (1 << n); i++) { int mask = i; vi v; while (mask) { v.push_back(__builtin_ctz(mask)); mask -= mask & (-mask); } bool b = true; int curr = 0; for (int i : v) { for (int j : v) { if (graph[i][j]) { b = false; break; } } if (!b) break; curr += confidence[i]; } if (b) chkmax(ans, curr); } return ans; }
#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...