# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
441924 | 2021-07-06T14:47:05 Z | PiejanVDC | 슈퍼트리 잇기 (IOI20_supertrees) | C++17 | 1 ms | 292 KB |
#include "supertrees.h" #include <bits/stdc++.h> using namespace std; int construct(vector<vector<int>> p) { int n = p.size(); vector<vector<int>>v(n,vector<int>(n,0)); for(int i = 0 ; i < n-1 ; i++) { for(int j = i+1 ; j < n ; j++) { if(p[i][j]) { bool ok=true; stack<pair<int,int>>s; s.push({i,-1}); while(!s.empty()) { if(s.top().first == j) ok=false; break; for(int k = 0 ; k < n ; k++) { if(k==s.top().first||k==s.top().second) continue; if(v[s.top().first][k]) { s.push({k,s.top().first}); } } } if(ok) { v[i][j]=1,v[j][i]=1; } } } } for(int i = 0 ; i < n ; i++) { for(int j = i+1 ; j < n ; j++) { if(!p[i][j]) { bool ok=true; stack<pair<int,int>>s; s.push({i,-1}); while(!s.empty()) { if(s.top().first == j) ok=false; break; for(int k = 0 ; k < n ; k++) { if(k==s.top().first||k==s.top().second) continue; if(v[s.top().first][k]) { s.push({k,s.top().first}); } } } if(!ok) { return 0; } } } } build(v); return 1; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Incorrect | 1 ms | 204 KB | Too many ways to get from 0 to 2, should be 1 found no less than 2 |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Incorrect | 1 ms | 204 KB | Too many ways to get from 0 to 2, should be 1 found no less than 2 |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 0 ms | 204 KB | Output is correct |
4 | Incorrect | 1 ms | 292 KB | Answer gives possible 1 while actual possible 0 |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Incorrect | 1 ms | 204 KB | Too many ways to get from 1 to 4, should be 1 found no less than 2 |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Incorrect | 1 ms | 204 KB | Too many ways to get from 0 to 2, should be 1 found no less than 2 |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Incorrect | 1 ms | 204 KB | Too many ways to get from 0 to 2, should be 1 found no less than 2 |
4 | Halted | 0 ms | 0 KB | - |