| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 133466 | tnbs10 | ZigZag (COCI17_zigzag) | Cpython 3 | 896 ms | 14924 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
k, n = map(int, input().split())
a = [[] for i in range(26)]
for i in range(k):
    x = input()
    a[ord(x[0]) - 97].append(x)
for i in range(26):
    a[i].sort()
    # print(a[i])
# napraviti [[adam, az], [ba, bd]] i onda samo šaltati
# kad se uzme jednom a da se uzme adam i baci ga se na kraj
# [adam, az] -> [az, adam]
#
# uvijek uzeti prvu u listi tog slova
r = [input() for i in range(n)]
for i in r:
    print(a[ord(i) - 97][0])
    a[ord(i) - 97].append(a[ord(i) - 97].pop(0))
    
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
