답안 #788269

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
788269 2023-07-20T04:17:01 Z mannshah1211 슈퍼트리 잇기 (IOI20_supertrees) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#include "supertrees.h"
using namespace std;



void build(vector<vector<int>> b);

struct DSU {
	vector<int> link, siz;
	DSU (int n) : link(n), siz(n, 1) {
		iota(all(link), 0ll);
	}
	
	int get(int x) {
		if (link[x] == x) {
			return x;
		}
		return link[x] = get(link[x]);
	}
	
	bool unite(int a, int b) {
	   a = get(a), b = get(b);
	   if (a == b) {
	   	return false;
	   }
	   
	   if (siz[a] < siz[b]) {
	   	swap(a, b);
	   }
	   link[b] = a;
	   siz[a] += siz[b];
	   return true;
	}
	
	bool same(int a, int b) {
		return (get(a) == get(b));
	}
	
};

int construct(vector<vector<int>> p) {
	vector<vector<int>> b(p.size(), vector<int>(p.size()));
	for (int i = 0; i < n - 1; i++) {
		b[i][i + 1] = 1;
		b[i + 1][i] = 1;
	}
	build(b);
	return 1;
}

Compilation message

supertrees.cpp: In constructor 'DSU::DSU(int)':
supertrees.cpp:12:8: error: 'all' was not declared in this scope; did you mean 'std::filesystem::perms::all'?
   12 |   iota(all(link), 0ll);
      |        ^~~
      |        std::filesystem::perms::all
In file included from /usr/include/c++/10/filesystem:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:129,
                 from supertrees.cpp:1:
/usr/include/c++/10/bits/fs_fwd.h:148:7: note: 'std::filesystem::perms::all' declared here
  148 |       all  =  0777,
      |       ^~~
supertrees.cpp: In function 'int construct(std::vector<std::vector<int> >)':
supertrees.cpp:44:22: error: 'n' was not declared in this scope
   44 |  for (int i = 0; i < n - 1; i++) {
      |                      ^