Submission #59927556


Source Code Expand

Copy
"""
<>
- `S`
- `K` `S`
- 2
"""
S = input()
Q = int(input())
K = list(map(int, input().split()))
ans = []
for k in K:
# 0-index
k -= 1
#
di, mo = divmod(k, len(S))
#
s = S[mo]
#
if bin(di).count("1") % 2 == 1:
s = s.swapcase()
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
"""
<方針>
- `S` の最終的な長さは無限として良い.
- まず,`K` が最初の状態 `S` のどの文字に注目しているかをみる.
- その次に,その文字が大小反転しているかどうかを2進数で確認する.
"""
S = input()
Q = int(input())
K = list(map(int, input().split()))
ans = []
for k in K:
  # 0-index
  k -= 1
  # 最初の文字列の長さで割ってみる.
  di, mo = divmod(k, len(S))
  # 注目している文字
  s = S[mo]
  # 反転の判定
  if bin(di).count("1") % 2 == 1:
    s = s.swapcase()
  
  ans.append(s)
  
print(*ans)

Submission Info

Submission Time
Task D - Strange Mirroring
User mattsunkun
Language Python (PyPy 3.10-v7.3.12)
Score 350
Code Size 620 Byte
Status AC
Exec Time 359 ms
Memory 124812 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 350 / 350
Status
AC × 3
AC × 63
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All sample_01.txt, sample_02.txt, sample_03.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt, test_23.txt, test_24.txt, test_25.txt, test_26.txt, test_27.txt, test_28.txt, test_29.txt, test_30.txt, test_31.txt, test_32.txt, test_33.txt, test_34.txt, test_35.txt, test_36.txt, test_37.txt, test_38.txt, test_39.txt, test_40.txt, test_41.txt, test_42.txt, test_43.txt, test_44.txt, test_45.txt, test_46.txt, test_47.txt, test_48.txt, test_49.txt, test_50.txt, test_51.txt, test_52.txt, test_53.txt, test_54.txt, test_55.txt, test_56.txt, test_57.txt, test_58.txt, test_59.txt, test_60.txt
Case Name Status Exec Time Memory
sample_01.txt AC 65 ms 76224 KB
sample_02.txt AC 65 ms 76120 KB
sample_03.txt AC 65 ms 76280 KB
test_01.txt AC 99 ms 86364 KB
test_02.txt AC 132 ms 98756 KB
test_03.txt AC 82 ms 84384 KB
test_04.txt AC 99 ms 92540 KB
test_05.txt AC 102 ms 92388 KB
test_06.txt AC 227 ms 111988 KB
test_07.txt AC 209 ms 111680 KB
test_08.txt AC 219 ms 115260 KB
test_09.txt AC 88 ms 84756 KB
test_10.txt AC 109 ms 88768 KB
test_11.txt AC 68 ms 76964 KB
test_12.txt AC 222 ms 113556 KB
test_13.txt AC 97 ms 85912 KB
test_14.txt AC 221 ms 117044 KB
test_15.txt AC 154 ms 100096 KB
test_16.txt AC 190 ms 108268 KB
test_17.txt AC 222 ms 119124 KB
test_18.txt AC 210 ms 114528 KB
test_19.txt AC 280 ms 109260 KB
test_20.txt AC 120 ms 91552 KB
test_21.txt AC 127 ms 93164 KB
test_22.txt AC 201 ms 111236 KB
test_23.txt AC 147 ms 97972 KB
test_24.txt AC 314 ms 114524 KB
test_25.txt AC 211 ms 111196 KB
test_26.txt AC 210 ms 114176 KB
test_27.txt AC 80 ms 81744 KB
test_28.txt AC 183 ms 108128 KB
test_29.txt AC 121 ms 93300 KB
test_30.txt AC 127 ms 87916 KB
test_31.txt AC 187 ms 113636 KB
test_32.txt AC 182 ms 113236 KB
test_33.txt AC 158 ms 113720 KB
test_34.txt AC 167 ms 113372 KB
test_35.txt AC 155 ms 113700 KB
test_36.txt AC 359 ms 116832 KB
test_37.txt AC 252 ms 121164 KB
test_38.txt AC 238 ms 120220 KB
test_39.txt AC 227 ms 119800 KB
test_40.txt AC 230 ms 123948 KB
test_41.txt AC 228 ms 124812 KB
test_42.txt AC 229 ms 112192 KB
test_43.txt AC 248 ms 120128 KB
test_44.txt AC 230 ms 120984 KB
test_45.txt AC 237 ms 121180 KB
test_46.txt AC 231 ms 120632 KB
test_47.txt AC 224 ms 120260 KB
test_48.txt AC 348 ms 116768 KB
test_49.txt AC 250 ms 121280 KB
test_50.txt AC 239 ms 120508 KB
test_51.txt AC 235 ms 123932 KB
test_52.txt AC 234 ms 120392 KB
test_53.txt AC 234 ms 124024 KB
test_54.txt AC 234 ms 112568 KB
test_55.txt AC 253 ms 121568 KB
test_56.txt AC 237 ms 120396 KB
test_57.txt AC 234 ms 120548 KB
test_58.txt AC 234 ms 123968 KB
test_59.txt AC 236 ms 124208 KB
test_60.txt AC 167 ms 113220 KB


2025-04-06 (Sun)
04:18:41 +00:00