# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
550440 | Jarif_Rahman | Political Development (BOI17_politicaldevelopment) | C++17 | 865 ms | 28380 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define pb push_back
#define f first
#define sc second
using namespace std;
typedef long long int ll;
typedef string str;
int n, k;
int ans = 0;
vector<unordered_set<int>> v;
vector<int> nodes;
vector<int> ss;
set<pair<int,int>> deg;
void bf(int in){
if(in == nodes.size()){
bool ok = 1;
for(int i = 0; i < ss.size(); i++) for(int j = i+1; j < ss.size(); j++)
if(v[ss[i]].find(ss[j]) == v[ss[i]].end()) ok = 0;
if(ok) ans = max(ans, int(ss.size()));
return;
}
ss.pb(nodes[in]);
bf(in+1);
ss.pop_back();
bf(in+1);
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> n >> k;
v.resize(n);
for(int i = 0; i < n; i++){
int d; cin >> d;
while(d--){
int x; cin >> x;
v[i].insert(x);
}
}
for(int i = 0; i < n; i++) deg.insert({v[i].size(), i});
while(!deg.empty()){
auto [s, i] = *deg.begin();
deg.erase(deg.begin());
nodes.pb(i);
for(int x: v[i]) nodes.pb(x);
bf(0);
nodes.clear();
for(int x: v[i]){
deg.erase(make_pair(int(v[x].size()), x));
v[x].erase(i);
deg.insert(make_pair(int(v[x].size()), x));
}
}
cout << ans << "\n";
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |