Submission #615013

#TimeUsernameProblemLanguageResultExecution timeMemory
615013cheissmartFriend (IOI14_friend)C++14
11 / 100
41 ms3952 KiB
#include "friend.h" #include <bits/stdc++.h> #define F first #define S second #define V vector #define PB push_back #define EB emplace_back #define MP make_pair #define SZ(v) int((v).size()) #define ALL(v) (v).begin(), (v).end() using namespace std; typedef long long ll; typedef pair<int, int> pi; typedef V<int> vi; const int INF = 1e9 + 7, N = 10; vi G[N]; int findSample(int n, int a[], int host[], int op[]) { for(int i = 1; i < n; i++) { if(op[i] == 0) { G[host[i]].PB(i); G[i].PB(host[i]); } else if(op[i] == 1) { for(int j:G[host[i]]) { G[j].PB(i); G[i].PB(j); } } else { for(int j:G[host[i]]) { G[j].PB(i); G[i].PB(j); } G[host[i]].PB(i); G[i].PB(host[i]); } } int ans = 0; for(int mask = 0; mask < (1 << n); mask++) { int sum = 0; for(int i = 0; i < n; i++) sum += (mask >> i & 1) ? a[i] : 0; bool bad = false; for(int i = 0; i < n; i++) if(mask >> i & 1) for(int j:G[i]) { if(mask >> j & 1) bad = true; } if(bad) continue; 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...