2662021-04-07 18:42:374rt3xp02015. szeptembercpp11Accepted 13ms1844 KiB
#include<bits/stdc++.h>
using namespace std;

vector<int> p(100),r(100,1);
vector<bool> u1(100,0),u2(100,0);

int f(int v){
	if(p[v]==v) return v;
	return p[v]=f(p[v]);
}

void u(int a, int b){
	a=f(a);
	b=f(b);
	if(a==b) return;
	if(r[a]<r[b]) swap(a,b);
	p[b]=a;
	r[a]+=r[b];
}

void init(){
	for(int i=0;i<100;i++) p[i]=i;
}

struct kor{
	int x,y,r;
};

bool metsz(kor a, kor b){
	return (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y)<=(a.r+b.r)*(a.r+b.r);
}

int main(){
	int n,m,k; cin >> n >> m >> k;
	vector<kor> a(k); for(kor &i: a) cin >> i.x >> i.y >> i.r;
	init();
	for(int i=1;i<k;i++){
		for(int j=0;j<i;j++){
			if(metsz(a[i],a[j])) u(i,j);
		}
	}
	for(int i=0;i<k;i++){
		if(a[i].y<=a[i].r) u1[f(i)]=1;
		if(a[i].y>=m-a[i].r) u2[f(i)]=1;
	}
	for(int i=0;i<k;i++) if(u1[i] && u2[i]) return cout << "Nem vezet",0;
	cout << "Vezet";
}
1 - Accepted
Memory: 1752KiB
Time: 2ms

Program's output:
Vezet
Expected output:
Vezet
Checker output:
ok "Vezet"

2 - Accepted
Memory: 1760KiB
Time: 1ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

3 - Accepted
Memory: 1828KiB
Time: 1ms

Program's output:
Vezet
Expected output:
Vezet
Checker output:
ok "Vezet"

4 - Accepted
Memory: 1824KiB
Time: 1ms

Program's output:
Vezet
Expected output:
Vezet
Checker output:
ok "Vezet"

5 - Accepted
Memory: 1832KiB
Time: 1ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

6 - Accepted
Memory: 1720KiB
Time: 1ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

7 - Accepted
Memory: 1720KiB
Time: 1ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

8 - Accepted
Memory: 1720KiB
Time: 1ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

9 - Accepted
Memory: 1824KiB
Time: 13ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

10 - Accepted
Memory: 1824KiB
Time: 1ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

11 - Accepted
Memory: 1824KiB
Time: 1ms

Program's output:
Vezet
Expected output:
Vezet
Checker output:
ok "Vezet"

12 - Accepted
Memory: 1720KiB
Time: 1ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

13 - Accepted
Memory: 1828KiB
Time: 1ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

14 - Accepted
Memory: 1720KiB
Time: 1ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

15 - Accepted
Memory: 1824KiB
Time: 1ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

16 - Accepted
Memory: 1728KiB
Time: 1ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

17 - Accepted
Memory: 1832KiB
Time: 1ms

Program's output:
Vezet
Expected output:
Vezet
Checker output:
ok "Vezet"

18 - Accepted
Memory: 1728KiB
Time: 1ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

19 - Accepted
Memory: 1832KiB
Time: 1ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

20 - Accepted
Memory: 1728KiB
Time: 1ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

21 - Accepted
Memory: 1832KiB
Time: 1ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

22 - Accepted
Memory: 1840KiB
Time: 1ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

23 - Accepted
Memory: 1832KiB
Time: 1ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

24 - Accepted
Memory: 1832KiB
Time: 1ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

25 - Accepted
Memory: 1832KiB
Time: 1ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

26 - Accepted
Memory: 1836KiB
Time: 1ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

27 - Accepted
Memory: 1836KiB
Time: 1ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

28 - Accepted
Memory: 1732KiB
Time: 1ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

29 - Accepted
Memory: 1832KiB
Time: 1ms

Program's output:
Vezet
Expected output:
Vezet
Checker output:
ok "Vezet"

30 - Accepted
Memory: 1728KiB
Time: 1ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

31 - Accepted
Memory: 1832KiB
Time: 1ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

32 - Accepted
Memory: 1832KiB
Time: 1ms

Program's output:
Vezet
Expected output:
Vezet
Checker output:
ok "Vezet"

33 - Accepted
Memory: 1832KiB
Time: 1ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

34 - Accepted
Memory: 1832KiB
Time: 1ms

Program's output:
Vezet
Expected output:
Vezet
Checker output:
ok "Vezet"

35 - Accepted
Memory: 1836KiB
Time: 1ms

Program's output:
Vezet
Expected output:
Vezet
Checker output:
ok "Vezet"

36 - Accepted
Memory: 1840KiB
Time: 1ms

Program's output:
Nem vezet
Expected output:
Nem vezet
Checker output:
ok 2 tokens

37 - Accepted
Memory: 1844KiB
Time: 1ms

Program's output:
Vezet
Expected output:
Vezet
Checker output:
ok "Vezet"