Submission #586234

#TimeUsernameProblemLanguageResultExecution timeMemory
586234TekorFriend (IOI14_friend)C++17
11 / 100
1080 ms16956 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 c[M][M]; int findSample(int n,int d[],int st[],int type[]){ for(int i = 1;i < n;i++) { if(type[i] == 0) { g[st[i]].pb(i); g[i].pb(st[i]); c[i][st[i]] = 1; c[st[i]][i] = 1; }else if(type[i] == 1) { for(auto to : g[st[i]]) { g[to].pb(i); g[i].pb(to); c[i][to] = 1; c[to][i] = 1; } }else { g[st[i]].pb(i); g[i].pb(st[i]); c[i][st[i]] = 1; c[st[i]][i] = 1; for(auto to : g[st[i]]) { g[to].pb(i); g[i].pb(to); c[i][to] = 1; c[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)) && c[j][h]) { ch = 1; break; } } if(ch)break; sum += d[j]; } } if(!ch)mx = max(mx,sum); } return mx; }
#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...