Submission #1292027

#TimeUsernameProblemLanguageResultExecution timeMemory
1292027dimitri.shengeliaWorld Map (IOI25_worldmap)C++20
Compilation error
0 ms0 KiB
//#include "worldmap.h"
#include <bits/stdc++.h>

using namespace std;

vector <int> v;

void dfs ( int u, int v, vector <vector<int>> adj ) {

	v.push_back( v );

	for ( auto x : adj[v] ) {

		if ( x != u ) {

			dfs( v, x, adj );

			v.push_back( v );

		}

	}

	return;

}

vector < vector <int> > create_map(int N, int M, vector<int> A, vector<int> B) {

	vector< vector <int> > answer( N );
	vector< vector <int> > adj( N + 1 );

	for ( int i = 0; i < M; i++ ) {

		adj[A[i]].push_back( B[i] );

	}

	dfs( 0, 1, adj );

	for ( int i = 0; i < N; i++ ) {

		answer[i] = v;

	}

	return answer;

}

Compilation message (stderr)

worldmap.cpp: In function 'void dfs(int, int, std::vector<std::vector<int> >)':
worldmap.cpp:10:11: error: request for member 'push_back' in 'v', which is of non-class type 'int'
   10 |         v.push_back( v );
      |           ^~~~~~~~~
worldmap.cpp:18:27: error: request for member 'push_back' in 'v', which is of non-class type 'int'
   18 |                         v.push_back( v );
      |                           ^~~~~~~~~