Submission #1291637

#TimeUsernameProblemLanguageResultExecution timeMemory
1291637SofiatpcConnecting Supertrees (IOI20_supertrees)C++20
21 / 100
97 ms22032 KiB
#include "supertrees.h" #include <bits/stdc++.h> using namespace std; const int MAXN = 1005; int marc[MAXN]; int construct(vector<vector<int>> p) { int n = p.size(); vector<vector<int>> ans; ans.resize(n); for(int i = 0; i < n; i++){ ans[i].resize(n); for(int j = 0; j < n; j++)ans[i][j] = 0; } int nxt = 1; for(int i = 0; i < n; i++){ if(marc[i]){ for(int j = 0; j < n; j++){ if(p[i][j] && marc[j] != marc[i])return 0; if(!p[i][j] && marc[j] == marc[i])return 0; } }else{ int lst = -1; for(int j = 0; j < n; j++) if(p[i][j]){ marc[j] = nxt; if(lst != -1){ans[lst][j] = 1; ans[j][lst] = 1;} lst = j; } nxt++; } } build(ans); 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...