# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
847047 | 12345678 | 슈퍼트리 잇기 (IOI20_supertrees) | C++17 | 1 ms | 348 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "supertrees.h"
#include <bits/stdc++.h>
using namespace std;
const int nx=1e3+5;
int gc;
bool vs[nx];
vector<vector<int>> g(nx);
int construct(std::vector<std::vector<int>> p) {
int n = p.size();
vector<vector<int>> answer(n, vector<int> (n, 0));
for (int i=0; i<n; i++)
{
if (!vs[i])
{
queue<int> q;
q.push(i); vs[i]=1;
while (!q.empty())
{
int x=q.front(); q.pop();
g[gc].push_back(x);
for (int j=0; j<n; j++) if ((p[x][j]==2||p[j][x]==2)&&!vs[j]) q.push(j), vs[j]=1;
}
for (auto x:g[gc]) for (auto y:g[gc]) if (p[x][y]==0) return 0;
int s=g[gc].size();
if (s==1)
{
gc++;
continue;
}
for (int j=0; j<g[gc].size(); j++) answer[g[gc][j]][g[gc][(j+1)%s]]=answer[g[gc][(j+1)%s]][g[gc][j]]=1;
gc++;
}
}
build(answer);
return 1;
}
/*
5
1 0 0 0 0
2 1 2 0 0
2 2 1 0 0
0 0 0 1 2
0 0 0 2 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... |