Submission #422472

#TimeUsernameProblemLanguageResultExecution timeMemory
422472Apiram슈퍼트리 잇기 (IOI20_supertrees)C++14
Compilation error
0 ms0 KiB
#include "supertrees.h"
#include<bits/stdc++.h>
using namespace std;
void markall(int i ,int j ,vector<int>&f,vector<int>&b,vector<vector<int>>&p,vector<vector<int>>&answer){
int k = b[i];
while(k!=-1){
int u = j;	
while(u!=-1){
if (!answer[k][u]){
p[k][u]--;
p[u][k]--;
answer[k][u]++;
answer[u][k]++;}
u=f[u];}
k=b[k];
}
}
bool check(vector<int>f,vector<int>b,int i ,int j,vector<vector<int>>p){
int k = b[i];
while(k!=-1){
int u = j;	
while(u!=-1){
if (p[k][u]<=0)return false;
u=f[u];}
k=b[k];
}
return true;
}
int construct(vector<std::vector<int>> p) {
	int n = p.size();
	vector<vector<int>>answer(n,vector<int>(n,0));
	vector<pair<int,int>>ans;
	/*
	 1 1 0 0 - 0 - 1
	 1 1 1 0  0 - 1 -  2
	 1 0 1 1  2 - 3
	 1 0 1 0
	 //0 - 1 - 2 - 3 - 4
	 */
	 for (int i =0;i<n;++i){
	 	for (int j=i+1;j<n;++j){
	 	
	 	if(p[i][j] == 0)
			{
				for(int h = 0; h < n; h++)
				{
					if(p[i][h] == 1 && p[j][h] == 1)return 0;
				}
			}
	 	}
	 }
	 for (int i =0;i<n;++i){
	 	for (int j =0;j<n;++j){
	 	if (p[i][j]==1){
	 	if (j==i+1||j==i-1)answer[i][j]=1;}
	 	else  ans.push_back({i,j});
	 	}
	 	}
	 for (int i =0;i<ans.size();++i){
	 answer[0][ans[i].second]=1;
	 answer[ans[i].second][0]=1;
	 answer[ans[i].first][0]=1;
	 answer[0][ans[i].frst]=1;
	 //answer[ans[i].first][a]=1;
	 } 
	
	build(answer);
	return 1;
}

Compilation message (stderr)

supertrees.cpp: In function 'int construct(std::vector<std::vector<int> >)':
supertrees.cpp:59:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   59 |   for (int i =0;i<ans.size();++i){
      |                 ~^~~~~~~~~~~
supertrees.cpp:63:20: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'frst'; did you mean 'first'?
   63 |   answer[0][ans[i].frst]=1;
      |                    ^~~~
      |                    first