답안 #296072

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
296072 2020-09-10T08:45:24 Z Dovran 장난감 기차 (IOI17_train) C++11
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#include "train.h"

#define N 20009
#define pii pair <int, int>
#define ff first
#define ss second
#define sz() size()
#define pb push_back
#define ll long long

using namespace std;

bool v[N];
vector<int>ans;

int who_wins(vector<int>o, vector<int>p, vector<int>u, vector<int>v){
	int n=o.sz();
	int m=u.sz();
	vector<int>e[N];
	int c[N];
	for(int i=0; i<m; i++){
		e[u[i]].pb(v[i]);
		if(u[i]==v[i])
			c[u[i]]=1;
	}
	for(int i=0; i<n; i++){
		if(p[i] and o[i] and c[i])
			v[i]=1;
		v[i]+=v[i-1];
		ans.pb(v[i]);
	}
	return ans;
}

Compilation message

train.cpp:17:5: error: ambiguating new declaration of 'int who_wins(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)'
   17 | int who_wins(vector<int>o, vector<int>p, vector<int>u, vector<int>v){
      |     ^~~~~~~~
In file included from train.cpp:2:
train.h:3:18: note: old declaration 'std::vector<int> who_wins(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)'
    3 | std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v);
      |                  ^~~~~~~~
train.cpp: In function 'int who_wins(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
train.cpp:33:9: error: cannot convert 'std::vector<int>' to 'int' in return
   33 |  return ans;
      |         ^~~