Submission #63628414


Source Code Expand

Copy
"""
<>
- `list` `0` `100`
- `.append()` `.pop()`
"""
#
cards = [0]*100
#
for _ in range(int(input())):
match list(map(int, input().split())):
#
case [1, x]:
cards.append(x)
#
case [2]:
print(cards.pop())
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
"""
<方針>
- `list` を山に見立てて、最初は `0` を `100` 要素持たせて初期化する。
- `.append()` で山に追加し、 `.pop()` で山から取り出す。
"""
# 山
cards = [0]*100

# クエリ処理
for _ in range(int(input())):
  match list(map(int, input().split())):
    # 追加
    case [1, x]:
      cards.append(x)
    # 取り出し
    case [2]:
      print(cards.pop())

Submission Info

Submission Time
Task B - Card Pile
User mattsunkun
Language Python (PyPy 3.10-v7.3.12)
Score 200
Code Size 423 Byte
Status AC
Exec Time 61 ms
Memory 76712 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 2
AC × 23
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt
All 00_sample_00.txt, 00_sample_01.txt, 01_handmade_00.txt, 01_handmade_01.txt, 01_handmade_02.txt, 01_handmade_03.txt, 01_handmade_04.txt, 01_handmade_05.txt, 02_random_00.txt, 02_random_01.txt, 02_random_02.txt, 02_random_03.txt, 02_random_04.txt, 02_random_05.txt, 02_random_06.txt, 02_random_07.txt, 02_random_08.txt, 02_random_09.txt, 02_random_10.txt, 02_random_11.txt, 02_random_12.txt, 02_random_13.txt, 02_random_14.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 59 ms 76548 KB
00_sample_01.txt AC 59 ms 76332 KB
01_handmade_00.txt AC 59 ms 76284 KB
01_handmade_01.txt AC 60 ms 76612 KB
01_handmade_02.txt AC 59 ms 76676 KB
01_handmade_03.txt AC 59 ms 76432 KB
01_handmade_04.txt AC 59 ms 76424 KB
01_handmade_05.txt AC 59 ms 76436 KB
02_random_00.txt AC 59 ms 76632 KB
02_random_01.txt AC 59 ms 76564 KB
02_random_02.txt AC 60 ms 76696 KB
02_random_03.txt AC 58 ms 76596 KB
02_random_04.txt AC 59 ms 76484 KB
02_random_05.txt AC 58 ms 76180 KB
02_random_06.txt AC 59 ms 76288 KB
02_random_07.txt AC 59 ms 76328 KB
02_random_08.txt AC 60 ms 76288 KB
02_random_09.txt AC 59 ms 76556 KB
02_random_10.txt AC 61 ms 76440 KB
02_random_11.txt AC 59 ms 76444 KB
02_random_12.txt AC 59 ms 76264 KB
02_random_13.txt AC 60 ms 76712 KB
02_random_14.txt AC 59 ms 76324 KB


2025-04-02 (Wed)
09:15:53 +00:00