Submission #1083934

#TimeUsernameProblemLanguageResultExecution timeMemory
1083934nickolasarapidisConnecting Supertrees (IOI20_supertrees)C++17
11 / 100
142 ms23888 KiB
#include "supertrees.h" #include <bits/stdc++.h> using namespace std; int construct(vector<vector<int>> p){ int N = p.size(); for(int i = 0; i < N; i++){ unordered_map<int, int> freq; for(int j = 0; j < N; j++){ freq[p[i][j]]++; } for(auto x : freq){ if(x.first == 0 or x.first == 1) continue; if(x.second == 1) return 0; } } vector<vector<int>> b(N, vector<int>(N, 0)); for(int i = 0; i < N; i++){ if(i != N - 1){ if(p[i][i + 1] == 1){ b[i][i + 1] = 1; b[i + 1][i] = 1; } else{ int j = i + 2; while(p[i][j] == 0 and j < N){ j++; } if(j != N){ b[i][j] = 1; b[j][i] = 1; } } } } build(b); 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...