結果

問題 No.2623 Room Allocation
ユーザー PNJPNJ
提出日時 2024-02-09 21:30:56
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 761 bytes
コンパイル時間 173 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 80,884 KB
最終ジャッジ日時 2024-02-09 21:31:10
合計ジャッジ時間 4,885 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
55,604 KB
testcase_01 AC 34 ms
55,604 KB
testcase_02 WA -
testcase_03 AC 34 ms
55,604 KB
testcase_04 AC 35 ms
55,604 KB
testcase_05 AC 39 ms
55,604 KB
testcase_06 WA -
testcase_07 AC 181 ms
80,884 KB
testcase_08 AC 180 ms
80,884 KB
testcase_09 AC 177 ms
80,884 KB
testcase_10 AC 35 ms
55,604 KB
testcase_11 AC 34 ms
55,604 KB
testcase_12 AC 34 ms
55,604 KB
testcase_13 AC 34 ms
55,604 KB
testcase_14 AC 152 ms
80,660 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 155 ms
80,660 KB
testcase_28 AC 94 ms
77,588 KB
testcase_29 AC 76 ms
76,312 KB
testcase_30 AC 148 ms
80,652 KB
testcase_31 AC 69 ms
76,308 KB
testcase_32 AC 68 ms
76,308 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
def Map():
  return list(map(int,input().split()))

N,X,Y = Map()
x = 0
y = 0
XX = deque()
YY = deque()
ans = 0
for i in range(N):
  P,c = map(str,input().split())
  P = int(P)
  cc = 1
  if c == 'A':
    if x < X:
      XX.append(i)
      x += 1
      ans += P
    elif y < Y:
      YY.append(i)
      y += 1
    else:
      if XX[0] < YY[0]:
        XX.popleft()
        XX.append(i)
        ans += P
      else:
        YY.popleft()
        YY.append(i)
  else:
    if y < Y:
      YY.append(i)
      y += 1
      ans += P
    elif x < X:
      XX.append(i)
      x += 1
    else:
      if YY[0] < XX[0]:
        YY.popleft()
        YY.append(i)
        ans += P
      else:
        XX.popleft()
        XX.append(i)
print(ans)
0