답안 #632274

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
632274 2022-08-19T19:36:17 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 "icc.h"
#include "grader.cpp"

using namespace std;

#define lg long long

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++)
			{
				int a[child[parents[i]].size()], b[child[parents[j]].size()];
				for(int k = 0; k < child[parents[i]].size(); k++)
				{
					a[k] = child[parents[i]][k];
				}
				for(int k = 0; k < child[parents[j]].size(); k++)
				{
					b[k] = child[parents[j]][k];
				}
				bool flag = query(parents[i], parents[j], a, b);
				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:44:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |   for(int i = 0; i < parents.size() && cur; i++)
      |                  ~~^~~~~~~~~~~~~~~~
icc.cpp:46:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |    for(int j = i+1; j < parents.size() && cur; j++)
      |                     ~~^~~~~~~~~~~~~~~~
icc.cpp:49:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 |     for(int k = 0; k < child[parents[i]].size(); k++)
      |                    ~~^~~~~~~~~~~~~~~~~~~~~~~~~~
icc.cpp:53:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   53 |     for(int k = 0; k < child[parents[j]].size(); k++)
      |                    ~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/bin/ld: /tmp/ccatVtxL.o: in function `ceoi_2016::BasicSolver::SetEdge(int, int)':
grader.cpp:(.text+0x0): multiple definition of `ceoi_2016::BasicSolver::SetEdge(int, int)'; /tmp/cc29vGyJ.o:icc.cpp:(.text+0x0): first defined here
/usr/bin/ld: /tmp/ccatVtxL.o: in function `ceoi_2016::BasicInteractiveSolver::MaxScoreFromAMInfo(ceoi_2016::AdjacencyMatrixInformation)':
grader.cpp:(.text+0x60): multiple definition of `ceoi_2016::BasicInteractiveSolver::MaxScoreFromAMInfo(ceoi_2016::AdjacencyMatrixInformation)'; /tmp/cc29vGyJ.o:icc.cpp:(.text+0x60): first defined here
/usr/bin/ld: /tmp/ccatVtxL.o: in function `ceoi_2016::GetAMInformation(std::array<std::array<int, 101ul>, 101ul> const&, std::vector<int, std::allocator<int> > const&)':
grader.cpp:(.text+0x230): multiple definition of `ceoi_2016::GetAMInformation(std::array<std::array<int, 101ul>, 101ul> const&, std::vector<int, std::allocator<int> > const&)'; /tmp/cc29vGyJ.o:icc.cpp:(.text+0x280): first defined here
/usr/bin/ld: /tmp/ccatVtxL.o: in function `ceoi_2016::BasicInteractiveSolver::ResetValidEdges()':
grader.cpp:(.text+0x3a0): multiple definition of `ceoi_2016::BasicInteractiveSolver::ResetValidEdges()'; /tmp/cc29vGyJ.o:icc.cpp:(.text+0x3f0): first defined here
/usr/bin/ld: /tmp/ccatVtxL.o: in function `ceoi_2016::BasicInteractiveSolver::GetIncludedExcluded(int, int, int*, int*)':
grader.cpp:(.text+0x410): multiple definition of `ceoi_2016::BasicInteractiveSolver::GetIncludedExcluded(int, int, int*, int*)'; /tmp/cc29vGyJ.o:icc.cpp:(.text+0x460): first defined here
/usr/bin/ld: /tmp/ccatVtxL.o: in function `ceoi_2016::Interaction::Fail(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
grader.cpp:(.text+0x630): multiple definition of `ceoi_2016::Interaction::Fail(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'; /tmp/cc29vGyJ.o:icc.cpp:(.text+0x680): first defined here
/usr/bin/ld: /tmp/ccatVtxL.o: in function `ceoi_2016::Interaction::SetScore(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
grader.cpp:(.text+0x690): multiple definition of `ceoi_2016::Interaction::SetScore(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'; /tmp/cc29vGyJ.o:icc.cpp:(.text+0x6e0): first defined here
/usr/bin/ld: /tmp/ccatVtxL.o: in function `ceoi_2016::Fail(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
grader.cpp:(.text+0x650): multiple definition of `ceoi_2016::Fail(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'; /tmp/cc29vGyJ.o:icc.cpp:(.text+0x6a0): first defined here
/usr/bin/ld: /tmp/ccatVtxL.o:(.bss+0x0): multiple definition of `ceoi_2016::interaction'; /tmp/cc29vGyJ.o:(.bss+0xfe8): first defined here
/usr/bin/ld: /tmp/ccatVtxL.o: in function `ceoi_2016::Expect(bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
grader.cpp:(.text+0x670): multiple definition of `ceoi_2016::Expect(bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'; /tmp/cc29vGyJ.o:icc.cpp:(.text+0x6c0): first defined here
/usr/bin/ld: /tmp/ccatVtxL.o: in function `ceoi_2016::Interaction::Query(int, int, int*, int*)':
grader.cpp:(.text+0x760): multiple definition of `ceoi_2016::Interaction::Query(int, int, int*, int*)'; /tmp/cc29vGyJ.o:icc.cpp:(.text+0x7b0): first defined here
/usr/bin/ld: /tmp/ccatVtxL.o: in function `query':
grader.cpp:(.text+0xf00): multiple definition of `query'; /tmp/cc29vGyJ.o:icc.cpp:(.text+0xf50): first defined here
/usr/bin/ld: /tmp/ccatVtxL.o: in function `GraderExitFail':
grader.cpp:(.text+0xf30): multiple definition of `GraderExitFail'; /tmp/cc29vGyJ.o:icc.cpp:(.text+0xf80): first defined here
/usr/bin/ld: /tmp/ccatVtxL.o: in function `NumVertices':
grader.cpp:(.text+0xf80): multiple definition of `NumVertices'; /tmp/cc29vGyJ.o:icc.cpp:(.text+0xfd0): first defined here
/usr/bin/ld: /tmp/ccatVtxL.o: in function `ceoi_2016::BasicSolver::Query(int, int, int*, int*)':
grader.cpp:(.text+0xfa0): multiple definition of `ceoi_2016::BasicSolver::Query(int, int, int*, int*)'; /tmp/cc29vGyJ.o:icc.cpp:(.text+0x10a0): first defined here
/usr/bin/ld: /tmp/ccatVtxL.o: in function `ceoi_2016::BasicInteractiveSolver::IsAlreadyGood(int, int, int*, int*)':
grader.cpp:(.text+0x1380): multiple definition of `ceoi_2016::BasicInteractiveSolver::IsAlreadyGood(int, int, int*, int*)'; /tmp/cc29vGyJ.o:icc.cpp:(.text+0x1480): first defined here
/usr/bin/ld: /tmp/ccatVtxL.o: in function `ceoi_2016::BasicInteractiveSolver::Query(int, int, int*, int*)':
grader.cpp:(.text+0x1760): multiple definition of `ceoi_2016::BasicInteractiveSolver::Query(int, int, int*, int*)'; /tmp/cc29vGyJ.o:icc.cpp:(.text+0x1860): first defined here
/usr/bin/ld: /tmp/ccatVtxL.o: in function `ceoi_2016::Interaction::DecideScore()':
grader.cpp:(.text+0x1950): multiple definition of `ceoi_2016::Interaction::DecideScore()'; /tmp/cc29vGyJ.o:icc.cpp:(.text+0x1a50): first defined here
/usr/bin/ld: /tmp/ccatVtxL.o: in function `ceoi_2016::Interaction::SetEdge(int, int)':
grader.cpp:(.text+0x1ba0): multiple definition of `ceoi_2016::Interaction::SetEdge(int, int)'; /tmp/cc29vGyJ.o:icc.cpp:(.text+0x1ca0): first defined here
/usr/bin/ld: /tmp/ccatVtxL.o: in function `setRoad':
grader.cpp:(.text+0x1c60): multiple definition of `setRoad'; /tmp/cc29vGyJ.o:icc.cpp:(.text+0x1d60): first defined here
/usr/bin/ld: /tmp/ccatVtxL.o: in function `InitGrader':
grader.cpp:(.text+0x1c80): multiple definition of `InitGrader'; /tmp/cc29vGyJ.o:icc.cpp:(.text+0x1d80): first defined here
/usr/bin/ld: /tmp/ccatVtxL.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc29vGyJ.o:icc.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccatVtxL.o: in function `ceoi_2016::BasicInteractiveSolver::UniteVertices(int, int)':
grader.cpp:(.text+0x1fc0): multiple definition of `ceoi_2016::BasicInteractiveSolver::UniteVertices(int, int)'; /tmp/cc29vGyJ.o:icc.cpp:(.text+0x2260): first defined here
/usr/bin/ld: /tmp/ccatVtxL.o: in function `ceoi_2016::BasicInteractiveSolver::SetEdge(int, int)':
grader.cpp:(.text+0x2050): multiple definition of `ceoi_2016::BasicInteractiveSolver::SetEdge(int, int)'; /tmp/cc29vGyJ.o:icc.cpp:(.text+0x22f0): first defined here
/usr/bin/ld: /tmp/cc29vGyJ.o: in function `main':
icc.cpp:(.text.startup+0x17): undefined reference to `run'
/usr/bin/ld: /tmp/ccatVtxL.o: in function `main':
grader.cpp:(.text.startup+0x17): undefined reference to `run'
collect2: error: ld returned 1 exit status