답안 #632257

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
632257 2022-08-19T19:18:26 Z Cyber_Wolf CEOI16_icc (CEOI16_icc) C++14
컴파일 오류
0 ms 0 KB
//CEOI '16 P1
//Problem: ICC
//Link: https://oj.uz/problem/view/CEOI16_icc

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("Ofast")

using namespace std;
using namespace __gnu_pbds;

#define lg long long
#define ordered_set	tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args);
#define endl \n
#define lbound(x, y) lower_bound(x.begin(), x.end(), y) 
#define ubound(x, y) upper_bound(x.begin(), x.end(), y) 
#define sortasc(v) sort(v.begin(), v.end())	
#define sortdesc(v) sort(v.rbegin(), v.rend())	
#define custom_array(a,l, r) int _##a[r-l+1]; int*a=_##a-l;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const lg MOD = 1e9+7, N = 101, M = 1e7+1, SZ = 1e3+1;

lg par[N], compSize[N];
vector<lg> child[N];

lg getParent(lg src)
{
	if(src == par[src])	return src;
	return par[src] = getParent(par[src]);
}

void join(lg u, lg v)
{
	u = getParent(u), v = getParent(v);
	if(u == v)	return;
	if(compSize[u] > compSize[v])	swap(u, v);
	par[u] = v;
	for(auto it : child[u])	child[v].push_back(it);
	compSize[v] += compSize[u];
}


void run(lg n)
{
	for(int i = 1; i <= n; i++)	par[i] = i, compSize[i] = 1;
	lg x = n-1;
	while(x--)
	{
		vector<lg> parents;
		for(int i = 1; i <= n; i++)	if(par[i] == i)	parents.push_back(i);
		bool cur = true;
		for(int i = 0; i < parents.size() && cur; i++)
		{
			for(int j = i+1; j < parents.size() && cur; j++)
			{
				bool flag = query(parents[i], parents[j], child[parents[i]], child[parents[j]]);
				if(flag)
				{
					join(parents[i], parents[j]);
					setRoad(parents[i], parents[j]);
					cur = false;
					break;
				}
			}
		}
	}
	return;
}

Compilation message

icc.cpp: In function 'void run(long long int)':
icc.cpp:56:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   56 |   for(int i = 0; i < parents.size() && cur; i++)
      |                  ~~^~~~~~~~~~~~~~~~
icc.cpp:58:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   58 |    for(int j = i+1; j < parents.size() && cur; j++)
      |                     ~~^~~~~~~~~~~~~~~~
icc.cpp:60:17: error: 'query' was not declared in this scope
   60 |     bool flag = query(parents[i], parents[j], child[parents[i]], child[parents[j]]);
      |                 ^~~~~
icc.cpp:64:6: error: 'setRoad' was not declared in this scope
   64 |      setRoad(parents[i], parents[j]);
      |      ^~~~~~~