| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 971484 | gutzzy | Political Development (BOI17_politicaldevelopment) | C++14 | 3051 ms | 524288 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int main(){
int n, k, d, a;
cin >> n >> k;
vector<vector<int>> ady(n,vector<int>(n,0));
vector<vector<int>> last(n);
for(int i=0;i<n;i++){
last[i] = {i};
cin >> d;
for(int j=0;j<d;j++){
cin >> a;
ady[min(i,a)][max(i,a)] = 1;
}
}
int cur = 2;
while(cur<=k){
int s = last.size();
vector<vector<int>> nw;
for(int i=0;i<s;i++){
// last[i] --> completed graphs of cur-1 nodes
for(int x=0;x<n;x++){
bool found = true;
for(auto p:last[i]){
if(ady[min(x,p)][max(x,p)]==0){
found = false;
break;
}
}
if(found){
last[i].push_back(x);
nw.push_back(last[i]);
last[i].pop_back();
//for(int kk=0;kk<last[i].size();kk++) cout << last[i][kk] << " ";
//cout << x << endl;
}
}
}
if(nw.size()==0) break;
else{
last = nw;
cur++;
}
}
cout << cur-1 << endl;
}| # | 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... | ||||
