| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 603554 | CyberCow | 슈퍼트리 잇기 (IOI20_supertrees) | C++17 | 218 ms | 30220 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "supertrees.h"
#include <vector>
#include <queue>
#include <unordered_set>
using namespace std;
int construct(vector<vector<int>> p) {
int n = p.size();
vector<vector<int>> ans(n);
vector<int> a(n);
vector<int> g[1005];
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
ans[i].push_back(0);
if (p[i][j])
{
g[i].push_back(j);
g[j].push_back(i);
}
}
}
int st1 = 0, st2 = 0, st0 = 0;
for (int i = 0; i < n; i++)
{
for (int j = 0; j < p[i].size(); j++)
{
if (p[i][j] == 1)
st1 = 1;
else if (p[i][j] == 2)
st2 = 1;
else
st0 = 1;
}
}
if (st1 == 1 && st2 == 0 && st0 == 0)
{
for (int i = 1; i < n; i++)
{
ans[0][i] = 1;
}
for (int i = 1; i < n; i++)
{
ans[i][0] = 1;
}
}
else if ((st0 == 1 || st1 == 1) && st2 == 0)
{
queue<int> q;
for (int i = 0; i < n; i++)
{
if (a[i] == 0)
{
vector<int> va;
q.push(i);
while (!q.empty())
{
int x = q.front();
va.push_back(x);
a[x] = 1;
q.pop();
for (int j = 0; j < g[x].size(); j++)
{
if (a[g[x][j]] == 0)
{
q.push(g[x][j]);
a[g[x][j]] = 1;
}
}
}
for (int j = 0; j < va.size() - 1; j++)
{
ans[va[j]][va[j + 1]] = 1;
ans[va[j + 1]][va[j]] = 1;
}
}
}
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
if (p[i][j] == 0 && ans[i][j] != 0)
return 0;
}
}
}
build(ans);
return 1;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
