# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
927768 | 2024-02-15T10:12:54 Z | Rifal | 슈퍼트리 잇기 (IOI20_supertrees) | C++14 | 1 ms | 496 KB |
#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] == 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(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; } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Incorrect | 0 ms | 496 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 | 348 KB | Output is correct |
2 | Incorrect | 0 ms | 496 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 | 344 KB | Output is correct |
2 | Correct | 1 ms | 344 KB | Output is correct |
3 | Correct | 0 ms | 344 KB | Output is correct |
4 | Incorrect | 0 ms | 348 KB | Answer gives possible 1 while actual possible 0 |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 496 KB | Output is correct |
3 | Incorrect | 0 ms | 348 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 | 0 ms | 348 KB | Output is correct |
2 | Incorrect | 0 ms | 496 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 | 348 KB | Output is correct |
2 | Incorrect | 0 ms | 496 KB | Too few ways to get from 0 to 1, should be 1 found 0 |
3 | Halted | 0 ms | 0 KB | - |