# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
769085 | 2023-06-29T07:18:05 Z | t6twotwo | 슈퍼트리 잇기 (IOI20_supertrees) | C++17 | 1 ms | 212 KB |
#include "supertrees.h" #include <bits/stdc++.h> using namespace std; int construct(std::vector<std::vector<int>> a) { int N = a.size(); vector<vector<int>> s(N); vector<bool> vis(N); for (int i = 0; i < N; i++) { if (vis[i]) { continue; } vis[i] = 1; queue<int> q; q.push(i); while (!q.empty()) { int x = q.front(); q.pop(); s[i].push_back(x); for (int y = 0; y < N; y++) { if (!vis[y] && a[x][y]) { vis[y] = 1; q.push(y); } } } } vector ans(N, vector<int>(N)); for (auto &v : s) { for (int i = 0; i < v.size(); i++) { for (int j = i + 1; j < v.size(); j++) { if (!a[v[i]][v[j]]) { return 0; } } } for (int i = 0; i < v.size(); i++) { int x = v[i]; int y = v[i + 1 == v.size() ? 0 : i + 1]; a[x][y] = a[y][x] = 1; } } build(ans); return 1; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Incorrect | 1 ms | 212 KB | Too few ways to get from 0 to 1, should be 1 found 0 |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Incorrect | 1 ms | 212 KB | Too few ways to get from 0 to 1, should be 1 found 0 |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Incorrect | 1 ms | 212 KB | Answer gives possible 1 while actual possible 0 |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Incorrect | 1 ms | 212 KB | Too few ways to get from 0 to 1, should be 2 found 0 |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Incorrect | 1 ms | 212 KB | Too few ways to get from 0 to 1, should be 1 found 0 |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Incorrect | 1 ms | 212 KB | Too few ways to get from 0 to 1, should be 1 found 0 |
3 | Halted | 0 ms | 0 KB | - |