結果

問題 No.2482 Sandglasses
ユーザー titiatitia
提出日時 2023-10-11 05:24:31
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,064 ms / 2,000 ms
コード長 885 bytes
コンパイル時間 97 ms
コンパイル使用メモリ 12,928 KB
実行使用メモリ 55,032 KB
最終ジャッジ日時 2024-04-28 09:05:53
合計ジャッジ時間 27,962 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
10,752 KB
testcase_01 AC 34 ms
10,752 KB
testcase_02 AC 31 ms
10,624 KB
testcase_03 AC 1,006 ms
54,584 KB
testcase_04 AC 976 ms
54,676 KB
testcase_05 AC 947 ms
54,564 KB
testcase_06 AC 946 ms
54,456 KB
testcase_07 AC 1,030 ms
54,456 KB
testcase_08 AC 959 ms
54,444 KB
testcase_09 AC 945 ms
54,452 KB
testcase_10 AC 1,002 ms
54,552 KB
testcase_11 AC 1,022 ms
54,572 KB
testcase_12 AC 1,062 ms
54,424 KB
testcase_13 AC 965 ms
54,552 KB
testcase_14 AC 951 ms
54,456 KB
testcase_15 AC 998 ms
54,580 KB
testcase_16 AC 952 ms
54,424 KB
testcase_17 AC 972 ms
54,580 KB
testcase_18 AC 953 ms
54,556 KB
testcase_19 AC 949 ms
54,584 KB
testcase_20 AC 961 ms
54,696 KB
testcase_21 AC 951 ms
54,588 KB
testcase_22 AC 1,064 ms
54,584 KB
testcase_23 AC 948 ms
55,032 KB
testcase_24 AC 874 ms
54,904 KB
testcase_25 AC 922 ms
54,852 KB
testcase_26 AC 925 ms
54,792 KB
testcase_27 AC 917 ms
55,032 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N,K,T=map(int,input().split())

A=input().split()
B=list(map(int,input().split()))

I=[0]*N

for i in range(N):
    if A[i]=="A":
        I[i]=B[i]
    else:
        I[i]=B[i]


T=T%(2*K)
L=[0]*N

for i in range(N):
    time=T
    if A[i]=="A":
        now=B[i]
        if now>=time:
            now-=time
            time=0
        else:
            time-=now
            now=0

        now+=time

        if now>=K:
            now=K-(now-K)
        
        L[i]=now
    else:
        now=B[i]
        if K-now>=time:
            now+=time
            time=0
        else:
            time-=K-now
            now=K

        now-=time

        if now<=0:
            now=-now
        
        L[i]=now

    #print(now,time)

L.sort()
IX=[(I[i],i) for i in range(N)]

IX.sort()

ANS=[0]*N

for i in range(N):
    ANS[IX[i][1]]=L[i]

print(*ANS)
0