Submission #70862940
Source Code Expand
""" <方針> - どの部品を取り付けたかを管理する変数 `arms` を使えば良さそう """ # 入力 X = int(input()) N = int(input()) W = list(map(int, input().split())) # 0-indexed Q = int(input()) # どの部品を取り付けたかを管理する変数 arms = [False]*N # 0-indexed # ループしてPを取得して、順次処理をする。 for _ in range(Q): P = int(input()) P -= 1 # 0-indexed # 取り外しor取り付けをして重さを変える X += (-1 if arms[P] else +1)*W[P] # 取り付けor取り外しを行う arms[P] = not arms[P] # 出力 print(X)
Submission Info
| Submission Time | |
|---|---|
| Task | B - Robot Weight |
| User | mattsunkun |
| Language | Python (PyPy 3.11-v7.3.20) |
| Score | 200 |
| Code Size | 635 Byte |
| Status | AC |
| Exec Time | 57 ms |
| Memory | 80428 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 200 / 200 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 00_sample_00.txt, 00_sample_01.txt |
| All | 00_sample_00.txt, 00_sample_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00_sample_00.txt | AC | 55 ms | 79976 KiB |
| 00_sample_01.txt | AC | 57 ms | 79816 KiB |
| 01_random_02.txt | AC | 55 ms | 80368 KiB |
| 01_random_03.txt | AC | 56 ms | 80204 KiB |
| 01_random_04.txt | AC | 57 ms | 80368 KiB |
| 01_random_05.txt | AC | 56 ms | 80204 KiB |
| 01_random_06.txt | AC | 55 ms | 80220 KiB |
| 01_random_07.txt | AC | 54 ms | 80344 KiB |
| 01_random_08.txt | AC | 54 ms | 80228 KiB |
| 01_random_09.txt | AC | 55 ms | 80228 KiB |
| 01_random_10.txt | AC | 54 ms | 80204 KiB |
| 01_random_11.txt | AC | 55 ms | 80224 KiB |
| 01_random_12.txt | AC | 52 ms | 79972 KiB |
| 01_random_13.txt | AC | 53 ms | 80144 KiB |
| 01_random_14.txt | AC | 54 ms | 79796 KiB |
| 01_random_15.txt | AC | 54 ms | 80360 KiB |
| 01_random_16.txt | AC | 54 ms | 80428 KiB |