結果

問題 No.3282 Photos and Friends
ユーザー 回転
提出日時 2025-09-26 23:02:19
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 712 bytes
コンパイル時間 425 ms
コンパイル使用メモリ 82,216 KB
実行使用メモリ 67,620 KB
最終ジャッジ日時 2025-09-26 23:02:29
合計ジャッジ時間 10,305 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 2
other RE * 50
権限があれば一括ダウンロードができます

ソースコード

diff #

from pulp import *
N,P,Q = list(map(int,input().split()))
friend = []

for _ in range(N):
    x,a,b = list(map(int,input().split()))
    friend.append((x,a,b))

p = LpProblem(sense=LpMaximize)
p += 0

ans = [[LpVariable(f"a_{i}",lowBound=0,cat=LpInteger), LpVariable(f"b_{i}",lowBound=0,cat=LpInteger)] for i in range(N)]
for i in range(N):
    x,a,b = friend[i]
    p += ans[i][0] + ans[i][1] == x
    p += ans[i][0] <= a
    p += ans[i][1] <= b

p += lpSum(i[0] for i in ans) <= P
p += lpSum(i[1] for i in ans) <= Q

solver = PULP_CBC_CMD(msg=False, timeLimit=1.5)
a = p.solve(solver)

if(a == 1):
    print("Yes")
    for i in ans:
        print(round(i[0].value()), round(i[1].value()))
else:
    print("No")
0