提出 #681842


ソースコード 拡げる

for t in xrange(input()):
	n = int(input())
	c = [list(raw_input()) for i in range(n)]
	count, i = 0, 0
	while len(c) > 1:
		j = (i+1)%len(c)
		a = c[j].pop(0)
		if a in c[i]:
			c[i].remove(a)
		else:
			c[i].append(a)
		if len(c[j]) == 0:
			del c[j]
			if j == 0: i-=1
		if len(c[i]) == 0:
			del c[i]
			i %= len(c)
		else:
			i = (i+1)%len(c)
		count += 1
		if count >= 10000:
			count = -1
			break
	print count

提出情報

提出日時
問題 A - ババ抜き
ユーザ yasuke
言語 Python (2.7.3)
得点 100
コード長 440 Byte
結果 AC
実行時間 544 ms
メモリ 3568 KiB

ジャッジ結果

セット名 All
得点 / 配点 100 / 100
結果
AC × 1
セット名 テストケース
All test_01.txt
ケース名 結果 実行時間 メモリ
test_01.txt AC 544 ms 3568 KiB