From 6dcbade76e6f9682a93ce156cc71eabeed82777a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EC=84=9C=EB=A6=BC?= <40015447+srlee056@users.noreply.github.com> Date: Thu, 9 May 2024 13:23:56 +0900 Subject: [PATCH] =?UTF-8?q?[level=202]=20Title:=20=EC=8A=A4=ED=82=AC?= =?UTF-8?q?=ED=8A=B8=EB=A6=AC,=20Time:=200.01=20ms,=20Memory:=2010=20MB=20?= =?UTF-8?q?-BaekjoonHub?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../README.md" | 4 +-- ...44\355\202\254\355\212\270\353\246\254.py" | 31 +++++++------------ 2 files changed, 13 insertions(+), 22 deletions(-) diff --git "a/\355\224\204\353\241\234\352\267\270\353\236\230\353\250\270\354\212\244/2/49993.\342\200\205\354\212\244\355\202\254\355\212\270\353\246\254/README.md" "b/\355\224\204\353\241\234\352\267\270\353\236\230\353\250\270\354\212\244/2/49993.\342\200\205\354\212\244\355\202\254\355\212\270\353\246\254/README.md" index 23606ea..fbaefea 100644 --- "a/\355\224\204\353\241\234\352\267\270\353\236\230\353\250\270\354\212\244/2/49993.\342\200\205\354\212\244\355\202\254\355\212\270\353\246\254/README.md" +++ "b/\355\224\204\353\241\234\352\267\270\353\236\230\353\250\270\354\212\244/2/49993.\342\200\205\354\212\244\355\202\254\355\212\270\353\246\254/README.md" @@ -4,7 +4,7 @@ ### 성능 요약 -메모리: 10.1 MB, 시간: 0.02 ms +메모리: 10 MB, 시간: 0.01 ms ### 구분 @@ -16,7 +16,7 @@ ### 제출 일자 -2023년 10월 6일 22:8:15 +2024년 05월 09일 13:23:53 ### 문제 설명 diff --git "a/\355\224\204\353\241\234\352\267\270\353\236\230\353\250\270\354\212\244/2/49993.\342\200\205\354\212\244\355\202\254\355\212\270\353\246\254/\354\212\244\355\202\254\355\212\270\353\246\254.py" "b/\355\224\204\353\241\234\352\267\270\353\236\230\353\250\270\354\212\244/2/49993.\342\200\205\354\212\244\355\202\254\355\212\270\353\246\254/\354\212\244\355\202\254\355\212\270\353\246\254.py" index 0f1eccf..a1376f4 100644 --- "a/\355\224\204\353\241\234\352\267\270\353\236\230\353\250\270\354\212\244/2/49993.\342\200\205\354\212\244\355\202\254\355\212\270\353\246\254/\354\212\244\355\202\254\355\212\270\353\246\254.py" +++ "b/\355\224\204\353\241\234\352\267\270\353\236\230\353\250\270\354\212\244/2/49993.\342\200\205\354\212\244\355\202\254\355\212\270\353\246\254/\354\212\244\355\202\254\355\212\270\353\246\254.py" @@ -3,26 +3,17 @@ def solution(skill, skill_trees): count = 0 + for skill_tree in skill_trees: - curr = 0 - hasAppeared = {k : False for k in skill} - - for s in skill_tree: - if s in hasAppeared: - - hasAppeared[s] = True - if curr < len(skill) and s == skill[curr]: - curr += 1 - - #print(hasAppeared) - #print(curr, [k for k, x in hasAppeared.items() if x]) - if curr == len( [k for k, x in hasAppeared.items() if x]): - + cur_idx = 0 + is_valid = True + for skill_ in skill_tree: + if skill_ in skill: + if skill_ != skill[cur_idx]: + is_valid = False + break + else: + cur_idx += 1 + if is_valid: count += 1 - - - - - - return count