CSES - NOI 2019 - Results
Submission details
Task:Thieves and Prisons
Sender:Santeri Toivonen
Submission time:2019-03-06 13:32:54 +0200
Language:C++
Status:COMPILE ERROR

Compiler report

input/code.cpp:13:28: error: expected unqualified-id before ';' token
 int n, m, a, b, as[101010],;
                            ^

Code

#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define ld long double
#define N (1<<18)
#define M 1000000007
#define P complex<long long>
#define X real()
#define Y imag()

using namespace std;

int n, m, a, b, as[101010],;
vector<int> vrk[101010];

void haku(int s, int p) {
	for(auto u:vrk[s]) {
		if(u == p)
			continue;
		haku(u, s);
	}
	cout << s << " ";
}

int main() {
	cin.tie(0);
	cout.tie(0);
	ios_base::sync_with_stdio(0);
	cin >> n >> m;
	if(m != n-1)
		return 0;
	for(int i=0; i<m; i++) {
		cin >> a >> b;
		vrk[a].push_back(b);
		vrk[b].push_back(a);
		as[a]++;
		as[b]++;
	}
	int cnt = 0;
	int s = 0;
	for(int i=1; i<=n; i++) {
		if(as[i] == 1) {
			cnt++;
			s = i;
		}
	}
	if(cnt > 2) {// Näin aina?
		cout << "IMPOSSIBLE";
	} else {
		haku(s, -1);
	}
}