답안 #728075

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
728075 2023-04-21T23:32:52 Z jnjwnwnw 사육제 (CEOI14_carnival) Python 3
0 / 100
225 ms 3244 KB
import random


def getAnItem(s):
	for thing in s:
		return thing
 
def test(lst):
	return int(input(str(len(lst)) + " " + " ".join([str(i+1) for i in lst]) + "\n"))

def div_and_conquer(l, u):
	if l == u - 1:
		return [{l}]
	mid = (l + u) // 2
	rl = div_and_conquer(l, mid)
	rr = div_and_conquer(mid, u)
	used = set()
	for val_in in rr:
		flag = True
		for key_out, val_out in enumerate(rl):
			if key_out not in used and test([getAnItem(val_in), getAnItem(val_out)]) == 1:
				val_out.update(val_out.union(val_in))
				used.add(key_out)
				flag = False
				break

		if flag:
			rl.append(val_in)
	return rl

def iterative():
	dat = []
	for i in range(n):
		flag = True
		for val in dat:
			if test([i, getAnItem(val)]) == 1:
				val.add(i)
				flag = False
				break
		if flag:
			dat.append({i})

	return dat




if __name__ =="__main__":
	n = int(input())
	c = int(input(str(n) + " " + " ".join([str(i+1) for i in range(n)]) + "\n"))
	div_and_conquer(0, n)
	res = iterative()
	toPrint = ["0"]*(n+1)

	for i, s in enumerate(res):
		for j in s:
			toPrint[j+1] = str(i+1)
	print(" ".join(toPrint))

# 결과 실행 시간 메모리 Grader output
1 Correct 38 ms 3136 KB Output is correct
2 Partially correct 101 ms 3116 KB Partially correct
3 Runtime error 223 ms 3128 KB Execution failed because the return code was nonzero
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 34 ms 3108 KB Output is correct
2 Partially correct 117 ms 3244 KB Partially correct
3 Partially correct 181 ms 3116 KB Partially correct
4 Runtime error 211 ms 3140 KB Execution failed because the return code was nonzero
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 20 ms 3032 KB Output is correct
2 Correct 41 ms 3092 KB Output is correct
3 Partially correct 161 ms 3120 KB Partially correct
4 Runtime error 225 ms 3232 KB Execution failed because the return code was nonzero
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 30 ms 3024 KB Output is correct
2 Correct 37 ms 3024 KB Output is correct
3 Runtime error 221 ms 3132 KB Execution failed because the return code was nonzero
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 29 ms 3100 KB Output is correct
2 Correct 69 ms 3112 KB Output is correct
3 Runtime error 221 ms 3152 KB Execution failed because the return code was nonzero
4 Halted 0 ms 0 KB -