제출 #1198650

#제출 시각아이디문제언어결과실행 시간메모리
1198650dosts장난감 기차 (IOI17_train)C++20
컴파일 에러
0 ms0 KiB
#include "train.h"
#include <bits/stdc++.h>
#define int long long
#define pii pair<int,int> 
#define vi vector<int>
#define ff first
#define ss second
#define sp << " " << 
#define all(x) x.begin(),x.end()
using namespace std;
vi ans,go,chk;
vector<vi> edges,egdes;

void dfs(int node) {
	for (auto it : egdes[node]) {
		if (ans[it]) continue;
		ans[it] = 1;
		dfs(it);
	}
}

int fl;

vi rr;
void dfs2(int node) {
	for (auto it : edges[node]) {
		if (rr[it]) continue;
		if (go[it]) continue;
		go[it] = 1;
		dfs2(it);
	}
}

std::vector<int32_t> who_wins(std::vector<int32_t> a, std::vector<int32_t> r, std::vector<int32_t> u, std::vector<int32_t> v) {
	int n = a.size();
	rr = r;
	std::vector<int32_t> res(n,1);
	ans.assign(n,0);
	go.assign(n,0);
	edges.resize(n);
	egdes.resize(n);
	int m = u.size();
	for (int i = 0;i<m;i++) {
		edges[u[i]].push_back(v[i]);
		egdes[v[i]].push_back(u[i]);
	}
	for (int i = 0;i<n;i++) {
		if (r[i]) continue;
		go.assign(n,0);
		dfs2(i);
		if (!go[i]) continue;
		dfs(i);
		for (int i = 0;i<n;i++) if (ans[i]) res[i] = 0;
	}
	return res;
}

컴파일 시 표준 에러 (stderr) 메시지

train.cpp: In function 'std::vector<int> who_wins(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
train.cpp:36:14: error: no match for 'operator=' (operand types are 'std::vector<long long int>' and 'std::vector<int>')
   36 |         rr = r;
      |              ^
In file included from /usr/include/c++/11/vector:72,
                 from train.h:1,
                 from train.cpp:1:
/usr/include/c++/11/bits/vector.tcc:198:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = long long int; _Alloc = std::allocator<long long int>]'
  198 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/11/bits/vector.tcc:199:42: note:   no known conversion for argument 1 from 'std::vector<int>' to 'const std::vector<long long int>&'
  199 |     operator=(const vector<_Tp, _Alloc>& __x)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/11/vector:67,
                 from train.h:1,
                 from train.cpp:1:
/usr/include/c++/11/bits/stl_vector.h:709:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = long long int; _Alloc = std::allocator<long long int>]'
  709 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |       ^~~~~~~~
/usr/include/c++/11/bits/stl_vector.h:709:26: note:   no known conversion for argument 1 from 'std::vector<int>' to 'std::vector<long long int>&&'
  709 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |                 ~~~~~~~~~^~~
/usr/include/c++/11/bits/stl_vector.h:730:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = long long int; _Alloc = std::allocator<long long int>]'
  730 |       operator=(initializer_list<value_type> __l)
      |       ^~~~~~~~
/usr/include/c++/11/bits/stl_vector.h:730:46: note:   no known conversion for argument 1 from 'std::vector<int>' to 'std::initializer_list<long long int>'
  730 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~