We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2cae78a commit d1301acCopy full SHA for d1301ac
1 file changed
live11/test113/문제2/백한결.py
@@ -0,0 +1,25 @@
1
+import sys
2
+from collections import defaultdict
3
+
4
5
+def main():
6
+ input = sys.stdin.readline
7
+ N = int(input())
8
9
+ graph = defaultdict(list)
10
11
+ for _ in range(N):
12
+ food = list(map(str, input().strip().split()))
13
+ K = int(food[0])
14
+ foods = food[1:]
15
16
+ current_node = graph
17
18
+ for f in foods:
19
+ if f not in current_node:
20
+ current_node[f] = defaultdict(list)
21
+ current_node = current_node[f]
22
23
24
+if __name__ == '__main__':
25
+ main()
0 commit comments