Submission #433609

#TimeUsernameProblemLanguageResultExecution timeMemory
433609SAADConnecting Supertrees (IOI20_supertrees)C++17
21 / 100
241 ms22152 KiB
#include <iostream> #include <math.h> #include <algorithm> #include <vector> #include <string.h> #include "supertrees.h" using namespace std; int tree[10002], n; int construct(vector<vector<int>> p) { n = (int)p.size(); vector <int> s(n); vector<vector<int>> a; a = p; for (auto&i:a[0]) i = 0; memset(tree, -1, sizeof(tree)); for (int i = 0; i < n; i++) { a[i] = a[0]; if (tree[i] != -1) { if (p[i] != p[tree[i]]) return 0; continue; } for (int j = 0; j < n; j++) { if (p[i][j]) { tree[j] = i; } } } for (int i = 0; i < n; i++) { if (tree[i] == i) { a[i] = p[i]; a[i][i] = 0; } else { a[i][tree[i]] = 1; } } build(a); 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...