제출 #780328

#제출 시각아이디문제언어결과실행 시간메모리
780328NothingXD친구 (IOI14_friend)C++17
11 / 100
31 ms4064 KiB
#include "friend.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef double ld; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef complex<ld> point; void debug_out(){cerr << endl;} template<typename Head, typename... Tail> void debug_out(Head H, Tail... T){ cout << H << ' '; debug_out(T...); } #define debug(...) cerr << "(" << #__VA_ARGS__ << "): ", debug_out(__VA_ARGS__) #define F first #define S second #define all(x) x.begin(), x.end() #define MP(x, y) make_pair(x, y) const int maxn = 1e3 + 10; vector<int> g[maxn]; int val[maxn]; // Find out best sample int findSample(int n,int w[],int p[],int t[]){ assert(n <= 10); for (int i = 1; i < n; i++){ if (t[i] == 1 || t[i] == 2){ for (auto u: g[p[i]]){ g[u].push_back(i); g[i].push_back(u); } } if (t[i] == 0 || t[i] == 2){ g[p[i]].push_back(i); g[i].push_back(p[i]); continue; } } int N = (1 << n); int ans = 0; for (int i = 1; i < N; i++){ int sum = 0; for (int j = 0; j < n; j++){ val[j] = (i >> j) & 1; if (val[j]) sum += w[j]; } bool flg = true; for (int j = 0; j < n; j++){ for (auto u: g[j]){ if (val[j] && val[u]) flg = false; } } if (flg) 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...