# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
314051 | 2020-10-18T01:38:08 Z | linear00000 | 슈퍼트리 잇기 (IOI20_supertrees) | C++14 | 261 ms | 22264 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++) { int cnt = 0; if (C[i].size() == 2) return 0; else if (C[i].size() >= 3) { for (int j=0; j<C[i].size() - 1; j++) { d[C[i][j]][C[i][j + 1]] = 1, d[C[i][j + 1]][C[i][j]] = 1; } d[C[i][C[i].size() - 1]][C[i][0]] = 1, d[C[i][0]][C[i][C[i].size() - 1]] = 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 | 0 ms | 384 KB | Output is correct |
2 | Correct | 0 ms | 384 KB | Output is correct |
3 | Correct | 0 ms | 384 KB | Output is correct |
4 | Correct | 0 ms | 384 KB | Output is correct |
5 | Correct | 0 ms | 384 KB | Output is correct |
6 | Correct | 1 ms | 384 KB | Output is correct |
7 | Correct | 0 ms | 384 KB | Output is correct |
8 | Correct | 11 ms | 1280 KB | Output is correct |
9 | Correct | 244 ms | 22264 KB | Output is correct |
10 | Correct | 1 ms | 384 KB | Output is correct |
11 | Correct | 0 ms | 384 KB | Output is correct |
12 | Correct | 11 ms | 1280 KB | Output is correct |
13 | Correct | 253 ms | 22260 KB | Output is correct |
14 | Correct | 1 ms | 384 KB | Output is correct |
15 | Correct | 0 ms | 384 KB | Output is correct |
16 | Correct | 5 ms | 768 KB | Output is correct |
17 | Correct | 123 ms | 12152 KB | Output is correct |
18 | Correct | 1 ms | 384 KB | Output is correct |
19 | Correct | 0 ms | 384 KB | Output is correct |
20 | Correct | 0 ms | 384 KB | Output is correct |
21 | Correct | 61 ms | 5880 KB | Output is correct |
22 | Correct | 260 ms | 22168 KB | Output is correct |
23 | Correct | 241 ms | 22136 KB | Output is correct |
24 | Correct | 259 ms | 22136 KB | Output is correct |
25 | Correct | 109 ms | 12280 KB | Output is correct |
26 | Correct | 108 ms | 12152 KB | Output is correct |
27 | Correct | 261 ms | 22136 KB | Output is correct |
28 | Correct | 257 ms | 22168 KB | Output is correct |
29 | Correct | 104 ms | 12280 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 512 KB | Output is correct |
3 | Incorrect | 1 ms | 384 KB | Too few ways to get from 1 to 2, should be 1 found 0 |
4 | 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 | - |