提出 #76650635


ソースコード 拡げる

def solve(a,b,x,y):
    x=abs(x)
    y=abs(y)
    z=min(x,y)
    cost=0
    cost+=2*min(a,b)*z

    if x-z>0:
        cost+=((x-z+1)//2)*min(3*b,a)
        cost+=((x-z)//2)*min(3*a,b)
    if y-z>0:
        cost+=((y-z+1)//2)*min(3*a,b)
        cost+=((y-z)//2)*min(3*b,a)
    print(cost)
    return 
for _ in range(int(input())):
    a,b,x,y=map(int,input().split())
    solve(a,b,x,y)

        
        

提出情報

提出日時
問題 E - Alternating Costs
ユーザ st0123
言語 Python (PyPy 3.11-v7.3.20)
得点 450
コード長 428 Byte
結果 AC
実行時間 506 ms
メモリ 109936 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 450 / 450
結果
AC × 1
AC × 33
セット名 テストケース
Sample 00_sample_00.txt
All 00_sample_00.txt, 01_handmade_00.txt, 01_handmade_01.txt, 01_handmade_02.txt, 01_handmade_03.txt, 01_handmade_04.txt, 01_handmade_05.txt, 01_handmade_06.txt, 01_handmade_07.txt, 01_handmade_08.txt, 01_handmade_09.txt, 01_handmade_10.txt, 01_handmade_11.txt, 01_handmade_12.txt, 01_handmade_13.txt, 01_handmade_14.txt, 01_handmade_15.txt, 02_random_00.txt, 02_random_01.txt, 02_random_02.txt, 02_random_03.txt, 02_random_04.txt, 02_random_05.txt, 02_random_06.txt, 02_random_07.txt, 02_random_08.txt, 02_random_09.txt, 02_random_10.txt, 02_random_11.txt, 02_random_12.txt, 02_random_13.txt, 02_random_14.txt, 02_random_15.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 47 ms 79600 KiB
01_handmade_00.txt AC 434 ms 108792 KiB
01_handmade_01.txt AC 435 ms 108920 KiB
01_handmade_02.txt AC 437 ms 108796 KiB
01_handmade_03.txt AC 432 ms 109072 KiB
01_handmade_04.txt AC 436 ms 108792 KiB
01_handmade_05.txt AC 444 ms 108792 KiB
01_handmade_06.txt AC 449 ms 109068 KiB
01_handmade_07.txt AC 446 ms 109000 KiB
01_handmade_08.txt AC 443 ms 108764 KiB
01_handmade_09.txt AC 443 ms 108856 KiB
01_handmade_10.txt AC 444 ms 108884 KiB
01_handmade_11.txt AC 454 ms 108852 KiB
01_handmade_12.txt AC 441 ms 108800 KiB
01_handmade_13.txt AC 445 ms 108904 KiB
01_handmade_14.txt AC 446 ms 108920 KiB
01_handmade_15.txt AC 466 ms 109044 KiB
02_random_00.txt AC 504 ms 109936 KiB
02_random_01.txt AC 497 ms 109832 KiB
02_random_02.txt AC 496 ms 109816 KiB
02_random_03.txt AC 501 ms 109900 KiB
02_random_04.txt AC 456 ms 108884 KiB
02_random_05.txt AC 459 ms 108912 KiB
02_random_06.txt AC 457 ms 109064 KiB
02_random_07.txt AC 455 ms 108884 KiB
02_random_08.txt AC 478 ms 108904 KiB
02_random_09.txt AC 489 ms 109112 KiB
02_random_10.txt AC 480 ms 108964 KiB
02_random_11.txt AC 486 ms 108976 KiB
02_random_12.txt AC 483 ms 108992 KiB
02_random_13.txt AC 486 ms 109076 KiB
02_random_14.txt AC 506 ms 109832 KiB
02_random_15.txt AC 488 ms 109100 KiB