# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
314047 | 2020-10-18T01:26:32 Z | linear00000 | 슈퍼트리 잇기 (IOI20_supertrees) | C++14 | 1 ms | 384 KB |
#include "supertrees.h" #include <bits/stdc++.h> using namespace std; vector<vector<int> > d; vector<int> C[1004]; int par[1004], num = 0; int findpar(int N) { if (N == par[N]) return N; else return par[N] = findpar(par[N]); } void merge(int a, int b) { int aa = findpar(a), bb = findpar(b); par[aa] = bb; } int construct(vector<vector<int> > v) { int n = v.size(); for (int i=0; i<n; i++) par[i] = i; d.resize(n); for (int i=0; i<n; i++) d[i].resize(n); for (int i=0; i<n; i++) { for (int j=i + 1; j < n; j++) { if (v[i][j] == 2 && i != j) merge(i, j); } } for (int i=0; i<n; i++) { for (int j=i + 1; j < n; j++) { if (v[i][j] == 0) { if (findpar(i) == findpar(j)) return 0; } } } for (int i=0; i<n; i++) par[i] = findpar(i); for (int i=0; i<n; i++) C[par[i]].push_back(i); for (int i=0; i<n; i++) { vector<int> tmp; for (int j=0; j<C[i].size(); j++) { if (C[i][j] != i) { d[i][C[i][j]] = 1, d[C[i][j]][i] = 1; tmp.push_back(C[i][j]); } } if (tmp.size() >= 2) { if (d[tmp[0]][tmp[1]] == 0) d[tmp[0]][tmp[1]] = 1; else { if (tmp.size() >= 3) d[tmp[0]][tmp[2]] = 1; } } } build(d); return 1; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Incorrect | 0 ms | 384 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 | 384 KB | Output is correct |
2 | Incorrect | 0 ms | 384 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 | 288 KB | Output is correct |
2 | Correct | 1 ms | 384 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Incorrect | 0 ms | 384 KB | Answer gives possible 1 while actual possible 0 |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Incorrect | 0 ms | 360 KB | b is not symmetric: b[0][1] (1) != b[1][0] (0) |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Incorrect | 0 ms | 384 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 | 384 KB | Output is correct |
2 | Incorrect | 0 ms | 384 KB | Too few ways to get from 0 to 1, should be 1 found 0 |
3 | Halted | 0 ms | 0 KB | - |