제출 #1032949

#제출 시각아이디문제언어결과실행 시간메모리
1032949c2zi6친구 (IOI14_friend)C++14
11 / 100
16 ms2756 KiB
#define _USE_MATH_DEFINES #include <bits/stdc++.h> #define ff first #define ss second #define pb push_back #define all(a) (a).begin(), (a).end() #define replr(i, a, b) for (int i = int(a); i <= int(b); ++i) #define reprl(i, a, b) for (int i = int(a); i >= int(b); --i) #define rep(i, n) for (int i = 0; i < int(n); ++i) #define mkp(a, b) make_pair(a, b) using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> PII; typedef vector<int> VI; typedef vector<PII> VPI; typedef vector<VI> VVI; typedef vector<VVI> VVVI; typedef vector<VPI> VVPI; typedef pair<ll, ll> PLL; typedef vector<ll> VL; typedef vector<PLL> VPL; typedef vector<VL> VVL; typedef vector<VVL> VVVL; typedef vector<VPL> VVPL; template<class T> T setmax(T& a, T b) {if (a < b) return a = b; return a;} template<class T> T setmin(T& a, T b) {if (a < b) return a; return a = b;} #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; template<class T> using indset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; #include "friend.h" int findSample(int n, int confidence[], int host[], int protocol[]){ if (n <= 10) { VVI gp(n); replr(u, 1, n-1) { int p = host[u]; int prot = protocol[u]; if (prot == 0 || prot == 2) { gp[u].pb(p); gp[p].pb(u); } if (prot == 1 || prot == 2) { for (int v : gp[p]) if (v != u) { gp[u].pb(v); gp[v].pb(u); } } } VVI bad(n, VI(n)); rep(u, n) for (int v : gp[u]) bad[u][v] = true; ll maxvalue = 0; rep(s, (1<<n)) { VI a; rep(i, n) if (s & (1<<i)) a.pb(i); ll value = 0; for (int u : a) for (int v : a) { if (bad[u][v]) { goto vat; } } for (int u : a) value += confidence[u]; vat: setmax(maxvalue, value); } return maxvalue; } return 0; }
#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...