結果

問題 No.2482 Sandglasses
ユーザー mymelochanmymelochan
提出日時 2023-09-22 22:05:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 757 ms / 2,000 ms
コード長 1,129 bytes
コンパイル時間 268 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 154,064 KB
最終ジャッジ日時 2024-04-28 09:01:52
合計ジャッジ時間 20,592 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
54,272 KB
testcase_01 AC 42 ms
54,144 KB
testcase_02 AC 42 ms
54,272 KB
testcase_03 AC 663 ms
153,796 KB
testcase_04 AC 645 ms
140,220 KB
testcase_05 AC 656 ms
153,668 KB
testcase_06 AC 656 ms
140,472 KB
testcase_07 AC 681 ms
140,616 KB
testcase_08 AC 665 ms
153,536 KB
testcase_09 AC 658 ms
153,540 KB
testcase_10 AC 656 ms
154,044 KB
testcase_11 AC 654 ms
153,664 KB
testcase_12 AC 657 ms
154,064 KB
testcase_13 AC 649 ms
153,920 KB
testcase_14 AC 663 ms
153,920 KB
testcase_15 AC 660 ms
153,668 KB
testcase_16 AC 662 ms
154,048 KB
testcase_17 AC 669 ms
153,796 KB
testcase_18 AC 679 ms
153,928 KB
testcase_19 AC 719 ms
153,792 KB
testcase_20 AC 749 ms
153,768 KB
testcase_21 AC 757 ms
153,800 KB
testcase_22 AC 666 ms
153,920 KB
testcase_23 AC 635 ms
146,748 KB
testcase_24 AC 650 ms
146,532 KB
testcase_25 AC 644 ms
147,148 KB
testcase_26 AC 639 ms
146,888 KB
testcase_27 AC 652 ms
146,868 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#############################################################

import sys
sys.setrecursionlimit(10**7)

from heapq import heappop,heappush
from collections import deque,defaultdict,Counter
from bisect import bisect_left, bisect_right
from itertools import product,combinations,permutations

ipt = sys.stdin.readline

def iin():
    return int(ipt())
def lmin():
    return list(map(int,ipt().split()))

MOD = 998244353
#############################################################

N,K,T = lmin()
A = input().split()
B = lmin()
C = [(b,i) for i,b in enumerate(B)]
ans = []
for i in range(N):
    if A[i] == "A":
        if T - B[i] > 0:
            T2 = T-B[i]
            tmp = T2%(K*2)
            
            ans.append(min(tmp,2*K-tmp))
        else:
            
            ans.append(B[i] - T)
    else:
        if T - (K-B[i]) - K > 0:
            T2 = T - (K-B[i]) - K
            tmp = T2%(K*2)
            
            ans.append(min(tmp,2*K-tmp))
        else:
            
            ans.append(min(B[i] + T, 2*K-B[i]-T))

C.sort()
ans.sort()
ans2 = [0]*N
for i in range(N):
    ans2[C[i][1]] = ans[i]
print(*ans2)
0