Submission #129510

#TimeUsernameProblemLanguageResultExecution timeMemory
129510antimirageFriend (IOI14_friend)C++14
0 / 100
38 ms4088 KiB
#include "friend.h" #include <bits/stdc++.h> #define fr first #define sc second #define mk make_pair #define pb push_back #define all(s) s.begin(), s.end() using namespace std; const int N = 15; vector <int> g[N], vec; int u[N], dp[1 << 15], ans, sum; int findSample(int n, int val[], int batya[], int type[]) { for (int i = 1; i < n; i++) { if (type[i] == 0) { g[batya[i]].pb(i); g[i].pb(batya[i]); } else if (type[i] == 1) { for (auto it: g[batya[i]]) { g[i].pb(it); g[it].pb(i); } } else { g[batya[i]].pb(i); g[i].pb(batya[i]); for (auto it: g[batya[i]]) { g[i].pb(it); g[it].pb(i); } } } for (int mask = 0; mask < (1 << n); mask++) { memset(u, 0, sizeof(u)); sum = 0; for (int j = 0; j < n; j++) { if (mask>>j&1) u[j] = 1, sum += val[j]; } bool fl = 1; for (int j = 0; j < n; j++) { if (u[j] == 0) continue; for (auto to : g[j]) { if (u[to]) fl = 0; } } if (fl) ans = max(ans, sum); } 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...