Submission #44488598
Source Code Expand
n, m = map(int, input().split())
S = input()
C = list(map(int, input().split()))
lst = [[] for _ in range(m)]
SS = [[] for _ in range(m)]
for i, c in enumerate(C):
lst[c - 1].append(i)
SS[c - 1].append(S[i])
ans = [""] * n
for i in range(m):
for j in range(len(lst[i])):
ans[lst[i][j]] = SS[i][j - 1]
print(*ans, sep="")
Submission Info
| Submission Time | |
|---|---|
| Task | C - Rotate Colored Subsequence |
| User | rin204 |
| Language | Python (PyPy 3.10-v7.3.12) |
| Score | 300 |
| Code Size | 358 Byte |
| Status | AC |
| Exec Time | 242 ms |
| Memory | 148020 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 300 / 300 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | example0.txt, example1.txt |
| All | 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, 016.txt, 017.txt, 018.txt, 019.txt, 020.txt, 021.txt, 022.txt, 023.txt, 024.txt, 025.txt, 026.txt, example0.txt, example1.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 000.txt | AC | 56 ms | 76308 KiB |
| 001.txt | AC | 118 ms | 147872 KiB |
| 002.txt | AC | 242 ms | 147844 KiB |
| 003.txt | AC | 115 ms | 137360 KiB |
| 004.txt | AC | 122 ms | 114464 KiB |
| 005.txt | AC | 157 ms | 118956 KiB |
| 006.txt | AC | 92 ms | 99752 KiB |
| 007.txt | AC | 110 ms | 105028 KiB |
| 008.txt | AC | 105 ms | 104320 KiB |
| 009.txt | AC | 233 ms | 146388 KiB |
| 010.txt | AC | 142 ms | 117460 KiB |
| 011.txt | AC | 123 ms | 115112 KiB |
| 012.txt | AC | 122 ms | 115040 KiB |
| 013.txt | AC | 117 ms | 113728 KiB |
| 014.txt | AC | 117 ms | 114160 KiB |
| 015.txt | AC | 114 ms | 115712 KiB |
| 016.txt | AC | 116 ms | 113580 KiB |
| 017.txt | AC | 117 ms | 147464 KiB |
| 018.txt | AC | 115 ms | 123932 KiB |
| 019.txt | AC | 116 ms | 124668 KiB |
| 020.txt | AC | 118 ms | 125724 KiB |
| 021.txt | AC | 116 ms | 134096 KiB |
| 022.txt | AC | 117 ms | 135880 KiB |
| 023.txt | AC | 121 ms | 125452 KiB |
| 024.txt | AC | 119 ms | 135868 KiB |
| 025.txt | AC | 120 ms | 148020 KiB |
| 026.txt | AC | 120 ms | 147816 KiB |
| example0.txt | AC | 56 ms | 76268 KiB |
| example1.txt | AC | 56 ms | 76648 KiB |