Created
February 2, 2016 17:23
-
-
Save avamsi/bfd61495486e3c987a6c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for t in xrange(1, int(raw_input()) + 1): | |
n, q = map(int, raw_input().split()) | |
qs = [map(int, raw_input().split()) for _ in xrange(q)] | |
print 'Scenario #%s:' % t | |
ref = [0] * (n + 1) | |
for a, b in qs: | |
if ref[a] >= ref[b] > 0: | |
if ref[a] != ref[b]: | |
print 'Suspicious bugs found!' | |
break | |
elif ref[a] == ref[b] == 0: | |
ref[a] = ref[b] = -1 | |
else: | |
if ref[a] > 0: | |
ref[b] = ref[a] | |
elif ref[b] > 0: | |
ref[a] = ref[b] | |
else: | |
ref[a] = ref[b] = -1 | |
else: | |
print 'No suspicious bugs found!' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment