# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
927701 | Rifal | Connecting Supertrees (IOI20_supertrees) | C++14 | 173 ms | 23376 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "supertrees.h"
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
const int M = 1e3 + 4;
int typ[M];
vector<int> v1[M], v2[M];
vector<vector<int>> gr;
bool egd[M][M];
int cnt = 1;
int construct(std::vector<std::vector<int>> p) {
bool ok = true;
int n = p.size();
for(int i = 0; i < n; i++) {
if(typ[i] == 0) {
typ[i] = cnt;
v1[cnt].push_back(i);
v2[cnt].push_back(i);
cnt++;
}
for(int j = 0; j < n; j++) {
if(j == i) continue;
if(p[i][j] == 1) {
if(typ[j] == 0) {
v1[typ[i]].push_back(j);
typ[j] = typ[i];
}
else if(typ[j] != typ[i]){
ok = false; break;
}
}
else if(p[i][j] == 2){
if(typ[j] == 0) {
v2[typ[i]].push_back(j);
typ[j] = typ[i];
}
else if(typ[j] != typ[i]){
ok = false; break;
}
}
else if(p[i][j] == 0 && typ[i] == typ[j]) {
ok = false; break;
}
}
if(!ok) break;
}
if(ok) {
for(int i = 1; i < cnt; i++) {
if(v1[i].size() > 1) {
for(int j = 1; j < v1[i].size(); j++) {
egd[v1[i][0]][v1[i][j]] = 1;
egd[v1[i][j]][v1[i][0]] = 1;
}
}
if(v2[i].size() > 1) {
for(int j = 1; j < v2[i].size(); j++) {
egd[v2[i][j]][v2[i][j-1]] = 1;
egd[v2[i][j-1]][v2[i][j]] = 1;
}
int siz = v2[i].size();
egd[v2[i][0]][v2[i][siz-1]] = 1;
egd[v2[i][siz-1]][v2[i][0]] = 1;
}
}
for(int i = 0; i < n; i++) {
// cout << 'i' << i << endl;
vector<int> cur;
for(int j = 0; j < n; j++) {
//cout << 'j' << ' ' << j << ' ' << egd[i][j] << endl;
cur.push_back(egd[i][j]);
}
gr.push_back(cur);
}
build(gr);
return 1;
}
else {
return 0;
}
}
컴파일 시 표준 에러 (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... |