제출 #586241

#제출 시각아이디문제언어결과실행 시간메모리
586241Tekor친구 (IOI14_friend)C++17
27 / 100
30 ms8524 KiB
#include "friend.h" #include <bits/stdc++.h> using namespace std; #define pii pair <int,int> #define f first #define s second #define mp make_pair #define pb push_back #define all(v) v.begin(),v.end() #define ll long long const int N = 3e5 + 100; const int M = 20; vector <int> g[N]; bool con[M][M]; int findSample(int n,int c[],int st[],int type[]){ if(n <= 10) { for(int i = 1;i < n;i++) { if(type[i] == 0) { g[st[i]].pb(i); g[i].pb(st[i]); con[i][st[i]] = 1; con[st[i]][i] = 1; }else if(type[i] == 1) { for(auto to : g[st[i]]) { g[to].pb(i); g[i].pb(to); con[i][to] = 1; con[to][i] = 1; } }else { g[st[i]].pb(i); g[i].pb(st[i]); con[i][st[i]] = 1; con[st[i]][i] = 1; for(auto to : g[st[i]]) { g[to].pb(i); g[i].pb(to); con[i][to] = 1; con[to][i] = 1; } } } int mx = 0; for(int i = 0;i < (1 << n);i++) { bool ch = 0; int sum = 0; for(int j = 0;j < n;j++) { if(i & (1 << j)) { for(int h = 0;h < j;h++) { if((i & (1 << h)) && con[j][h]) { ch = 1; break; } } if(ch)break; sum += c[j]; } } if(!ch)mx = max(mx,sum); } return mx; } int ans = 0; if(type[1] == 1) { for(int i = 0;i < n;i++)ans += c[i]; }else { for(int i = 0;i < n;i++)ans = max(ans,c[i]); } 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...