제출 #300583

#제출 시각아이디문제언어결과실행 시간메모리
300583Dilshod_Imomov슈퍼트리 잇기 (IOI20_supertrees)C++17
21 / 100
249 ms22264 KiB
#include "supertrees.h" #include <bits/stdc++.h> using namespace std; const int N = 1e3 + 7; int nn, comp, used[N], cc[N], cmp[N], ok; int construct(std::vector<std::vector<int>> p) { nn = p.size(); std::vector<std::vector<int>> answer; for (int i = 0; i < nn; i++) { std::vector<int> row; row.resize(nn); answer.push_back(row); } for ( int i = 0; i < nn; i++ ) { if ( !cc[i] ) { cc[i] = ++comp; } cmp[ cc[i] ] = i; for ( int j = 0; j < nn; j++ ) { if ( p[i][j] && i != j ) { if ( cc[j] && cc[j] != cc[i] ) { return 0; } if( cc[j] ) { continue; } cc[j] = cc[i]; answer[ cmp[ cc[i] ] ][j] = 1; answer[ j ][ cmp[ cc[i] ] ] = 1; cmp[ cc[i] ] = j; } } } for ( int i = 0; i < nn; i++ ) { for ( int j = 0; j < nn; j++ ) { if ( cc[i] == cc[j] ) { if ( !p[i][j] || !p[j][i] ) { return 0; } } } } build(answer); return 1; }
#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...