답안 #975659

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
975659 2024-05-05T16:38:00 Z vjudge1 Pizza (COCI21_pizza) Python 3
0 / 50
11 ms 3016 KB
"""
3 7 2 4
5
3 1 2 3
3 4 5 6
3 7 8 9
3 1 3 6
3 2 4 7
"""
ndislike = int(input())
dislike = []
for i in range(ndislike):
  dislike.append(int(input()))

nbingkisan = int(input())
set_binks = []
for i in range(nbingkisan):
  ncemilan = int(input())
  setcemilan = []
  for j in range(ncemilan):
    cemil = int(input())
    setcemilan.append(cemil)

  set_binks.append(setcemilan)

# ndislike = 2
# dislike = [1,2]
# nbingkisan = 4
# set_binks = [[1,4],[1,2,3],[3,4],[3,5,7]]

# print('-------')
# print(ndislike, end=' ')
# print(dislike)
# print(nbingkisan)
# print(set_binks)

def exist(el, set):
  cnt = 0
  for i in set:
    if (el-i==0):
      cnt += 1
      break
  return cnt

ans = 0
# print('Kita akan cek nih apakah bingkisan mengandung cemilan dislike')
a = 1
for i in set_binks:
  # print(f'Kita mulai dulu dari bingkisan ke {a} yaitu {i}')  
  # print('...' * 20)
  cnt = 0
  # print(f'Awalnya di bingkisan ini gak ada dislike dulu ya, yaitu = {cnt}')
  # print(f'Eval i = {i}')
  # print('Kita evaluasi bingkisan satu per satu ya')
  for j in i:
    # print(f'Kita evaluasi cemilan ke {j} apakah ada di dislike {dislike}')
    if (exist(j,dislike)>0):
      # print(f'Wah {j} ada nih di {dislike}')
      cnt += 1
      # print(f'Di cemilan ini ada dislike sebanyak {cnt}')
      # print('Cemilan berikutnya kita stop dulu ya')
      break

  if (cnt==0):
    # print('Gak ada dislike nih di sini')
    ans += 1
    # print(f'Jadi ada {ans} yang bisa di ambil nih')

  a += 1

# print(f'Final cnt = {ans}')
print(ans)
# 결과 실행 시간 메모리 Grader output
1 Runtime error 11 ms 3016 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 11 ms 2908 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 11 ms 2908 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 11 ms 2908 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 11 ms 2908 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -