# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
771026 | 2023-07-02T11:07:58 Z | OrazB | Connecting Supertrees (IOI20_supertrees) | C++14 | 2 ms | 2644 KB |
#include <bits/stdc++.h> #include "supertrees.h" using namespace std; #define N 100005 #define wr cout << "Continue debugging\n"; #define all(x) (x).begin(), (x).end() #define ll long long int #define pii pair <int, int> #define pb push_back #define ff first #define ss second vector<int> vec[N]; int construct(vector<vector<int>> p){ int n = p.size(); vector<vector<int>> b(n, vector<int>(n, 0)); vector<int> vis(n, 0), ok(n, 0); int cnt = 0; for (int i = 0; i < n; i++){ if (vis[i]){ if (p[i] != vec[vis[i]]) return 0; continue; } vis[i] = ++cnt; vector<int> v; for (int j = 0; j < n; j++){ if (p[i][j] and i != j){ if (p[i][j] == 1){ b[i][j] = b[j][i] = 1; vis[j] = cnt; }else v.pb(j), ok[j] = 1; } } if (ok[i] or !v.size()) continue; b[i][v[0]] = b[v[0]][i] = 1; b[i][v.back()] = b[v.back()][i] = 1; for (int i = 1; i < v.size(); i++){ b[v[i-1]][v[i]] = b[v[i]][v[i-1]] = 1; } } // for (int i = 0; i < n; i++){ // for (int j = 0; j < n; j++) cout << b[i][j] << ' '; // cout << '\n'; // } build(b); return 1; } // int main () // { // int n; // cin >> n; // vector<vector<int>> p(n, vector<int>(n)); // for (int i = 0; i < n; i++){ // for (int j = 0; j < n; j++) cin >> p[i][j]; // } // int x = construct(p); // }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2644 KB | Output is correct |
2 | Incorrect | 1 ms | 2644 KB | Answer gives possible 0 while actual possible 1 |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2644 KB | Output is correct |
2 | Incorrect | 1 ms | 2644 KB | Answer gives possible 0 while actual possible 1 |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2644 KB | Output is correct |
2 | Correct | 1 ms | 2644 KB | Output is correct |
3 | Correct | 1 ms | 2644 KB | Output is correct |
4 | Incorrect | 1 ms | 2644 KB | Answer gives possible 1 while actual possible 0 |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2644 KB | Output is correct |
2 | Correct | 1 ms | 2644 KB | Output is correct |
3 | Incorrect | 1 ms | 2644 KB | Answer gives possible 0 while actual possible 1 |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2644 KB | Output is correct |
2 | Incorrect | 1 ms | 2644 KB | Answer gives possible 0 while actual possible 1 |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2644 KB | Output is correct |
2 | Incorrect | 1 ms | 2644 KB | Answer gives possible 0 while actual possible 1 |
3 | Halted | 0 ms | 0 KB | - |