답안 #456252

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
456252 2021-08-06T09:47:25 Z BT21tata 슈퍼트리 잇기 (IOI20_supertrees) C++17
0 / 100
1 ms 204 KB
#include "supertrees.h"
#include<bits/stdc++.h>

using namespace std;


int construct(vector<vector<int>> p)
{
	int n = p.size(), mx=0;
	bool f=1;
	vector<vector<int>> ans;
	ans.resize(n);
	for (int i = 0; i < n; i++)
	{
		ans[i].resize(n);
	}
	vector<int>v;
	for(int i=0; i<n; i++)
	{
		v.clear(); v.push_back(i);
		for(int j=0; j<n; j++)
		{
			if(p[i][j]==2) v.push_back(j);
		}
		for(int j=0; j<(int)v.size()-1; j++)
				ans[v[j]][v[j+1]]=ans[v[j+1]][v[j]]=1;
		ans[v[0]][v[v.size()-1]]=ans[v[v.size()-1]][v[0]]=1;
	}
	for(int i=0; i<n; i++)
		for(int j=0; j<n; j++)
			if(i!=j and p[i][j]==1) ans[i][j]=ans[j][i]=1;
	build(ans);
	return 1;
}

Compilation message

supertrees.cpp: In function 'int construct(std::vector<std::vector<int> >)':
supertrees.cpp:9:20: warning: unused variable 'mx' [-Wunused-variable]
    9 |  int n = p.size(), mx=0;
      |                    ^~
supertrees.cpp:10:7: warning: unused variable 'f' [-Wunused-variable]
   10 |  bool f=1;
      |       ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB b[0][0] is not 0
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB b[0][0] is not 0
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 204 KB b[0][0] is not 0
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB b[0][0] is not 0
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB b[0][0] is not 0
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB b[0][0] is not 0
2 Halted 0 ms 0 KB -