結果

問題 No.2623 Room Allocation
ユーザー mkawa2mkawa2
提出日時 2024-02-09 21:49:20
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 1,131 bytes
コンパイル時間 113 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 30,640 KB
最終ジャッジ日時 2024-02-09 21:49:32
合計ジャッジ時間 8,937 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
9,984 KB
testcase_01 AC 30 ms
9,984 KB
testcase_02 AC 29 ms
9,984 KB
testcase_03 AC 27 ms
9,984 KB
testcase_04 AC 27 ms
9,984 KB
testcase_05 AC 27 ms
9,984 KB
testcase_06 AC 344 ms
14,572 KB
testcase_07 AC 343 ms
14,476 KB
testcase_08 AC 366 ms
14,572 KB
testcase_09 AC 346 ms
14,476 KB
testcase_10 AC 277 ms
14,848 KB
testcase_11 AC 274 ms
14,848 KB
testcase_12 AC 149 ms
11,776 KB
testcase_13 WA -
testcase_14 AC 602 ms
30,640 KB
testcase_15 AC 308 ms
19,692 KB
testcase_16 AC 89 ms
12,524 KB
testcase_17 AC 29 ms
10,112 KB
testcase_18 AC 283 ms
19,692 KB
testcase_19 AC 268 ms
19,052 KB
testcase_20 AC 277 ms
19,564 KB
testcase_21 AC 299 ms
19,692 KB
testcase_22 AC 215 ms
17,260 KB
testcase_23 AC 137 ms
14,316 KB
testcase_24 AC 281 ms
19,692 KB
testcase_25 AC 234 ms
17,900 KB
testcase_26 AC 47 ms
11,008 KB
testcase_27 AC 620 ms
29,528 KB
testcase_28 AC 287 ms
17,944 KB
testcase_29 AC 222 ms
15,724 KB
testcase_30 AC 588 ms
28,888 KB
testcase_31 AC 88 ms
11,520 KB
testcase_32 AC 224 ms
14,208 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

# sys.setrecursionlimit(1000005)
# sys.set_int_max_str_digits(200005)
int1 = lambda x: int(x)-1
pDB = lambda *x: print(*x, end="\n", file=sys.stderr)
p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr)
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()

dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
# inf = -1-(-1 << 31)
inf = -1-(-1 << 62)

md = 10**9+7
# md = 998244353

n,x,y=LI()
z=x+y
pp,cc=[],[]
for _ in range(n):
    p,c=SI().split()
    pp.append(int(p))
    cc.append(c=="B")

dd=[]
ans=0
for si in range(z):
    ss=[0,0]
    for i in range(si,n,z):
        p,c=pp[i],cc[i]
        ss[c]+=p
    ans+=ss[0]
    dd.append(ss[0]-ss[1])

dd.sort()
for j,d in enumerate(dd[:y]):
    if j>=n-x and d>=0:break
    ans-=d

print(ans)
0