답안 #593788

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
593788 2022-07-11T15:21:18 Z FatihSolak 장난감 기차 (IOI17_train) C++17
컴파일 오류
0 ms 0 KB
#include "train.h"
#include <bits/stdc++.h>
#define N 5005
using namespace std;
int path[N][N];
bool special[N];
vector<int> adj[N];
void dfs(int v,int num){
	vis[num][v] = 1;
	for(auto u:adj[v])[
		if(!vis[nun][u]){
			dfs(u,num);
		}
	]
}
vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) {
	int n = a.size();
	int m = u.size();
	for(int i=0;i<m;i++){
		ad[u].push_back(v);
	}
	for(int i = 0;i<n;i++){
		dfs(i,i);
	}
	for(int i = 0;i<n;i++){
		if(r[i]){
			for(auto u:adj[i]){
				if(path[u][v]){
					special[i] = 1;
				}
			}
		}
	}
	vector<int> res(n);
	for(int i = 0; i < n; i++){
		for(int j = 0;j<n;j++){
			if(special[j] && path[i][j]){
				res[i] = 1;
			}
		}
	}
	return res;
}

Compilation message

train.cpp: In function 'void dfs(int, int)':
train.cpp:9:2: error: 'vis' was not declared in this scope
    9 |  vis[num][v] = 1;
      |  ^~~
train.cpp:11:3: error: expected identifier before 'if'
   11 |   if(!vis[nun][u]){
      |   ^~
train.cpp: In lambda function:
train.cpp:15:1: error: expected '{' before '}' token
   15 | }
      | ^
train.cpp: In function 'void dfs(int, int)':
train.cpp:14:3: error: expected ';' before '}' token
   14 |  ]
      |   ^
      |   ;
   15 | }
      | ~  
train.cpp:10:11: warning: unused variable 'u' [-Wunused-variable]
   10 |  for(auto u:adj[v])[
      |           ^
train.cpp: In function 'std::vector<int> who_wins(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
train.cpp:20:3: error: 'ad' was not declared in this scope; did you mean 'a'?
   20 |   ad[u].push_back(v);
      |   ^~
      |   a
train.cpp:28:15: error: no match for 'operator[]' (operand types are 'int [5005]' and 'std::vector<int>')
   28 |     if(path[u][v]){
      |               ^