結果
問題 | No.2309 [Cherry 5th Tune D] 夏の先取り |
ユーザー | chro_96 |
提出日時 | 2023-05-19 23:11:19 |
言語 | C (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 8 ms / 3,000 ms |
コード長 | 3,157 bytes |
コンパイル時間 | 269 ms |
コンパイル使用メモリ | 31,232 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-12-20 01:41:52 |
合計ジャッジ時間 | 1,955 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
6,816 KB |
testcase_01 | AC | 3 ms
6,816 KB |
testcase_02 | AC | 3 ms
6,816 KB |
testcase_03 | AC | 2 ms
6,820 KB |
testcase_04 | AC | 3 ms
6,816 KB |
testcase_05 | AC | 2 ms
6,816 KB |
testcase_06 | AC | 3 ms
6,816 KB |
testcase_07 | AC | 2 ms
6,816 KB |
testcase_08 | AC | 3 ms
6,816 KB |
testcase_09 | AC | 2 ms
6,816 KB |
testcase_10 | AC | 2 ms
6,820 KB |
testcase_11 | AC | 2 ms
6,820 KB |
testcase_12 | AC | 2 ms
6,820 KB |
testcase_13 | AC | 3 ms
6,820 KB |
testcase_14 | AC | 2 ms
6,816 KB |
testcase_15 | AC | 2 ms
6,816 KB |
testcase_16 | AC | 2 ms
6,816 KB |
testcase_17 | AC | 2 ms
6,816 KB |
testcase_18 | AC | 3 ms
6,816 KB |
testcase_19 | AC | 2 ms
6,816 KB |
testcase_20 | AC | 2 ms
6,816 KB |
testcase_21 | AC | 2 ms
6,816 KB |
testcase_22 | AC | 2 ms
6,820 KB |
testcase_23 | AC | 2 ms
6,820 KB |
testcase_24 | AC | 3 ms
6,816 KB |
testcase_25 | AC | 2 ms
6,816 KB |
testcase_26 | AC | 3 ms
6,820 KB |
testcase_27 | AC | 2 ms
6,820 KB |
testcase_28 | AC | 2 ms
6,820 KB |
testcase_29 | AC | 2 ms
6,820 KB |
testcase_30 | AC | 2 ms
6,820 KB |
testcase_31 | AC | 6 ms
6,820 KB |
testcase_32 | AC | 6 ms
6,820 KB |
testcase_33 | AC | 6 ms
6,816 KB |
testcase_34 | AC | 6 ms
6,816 KB |
testcase_35 | AC | 5 ms
6,816 KB |
testcase_36 | AC | 1 ms
6,824 KB |
testcase_37 | AC | 1 ms
6,816 KB |
testcase_38 | AC | 1 ms
6,816 KB |
testcase_39 | AC | 1 ms
6,816 KB |
testcase_40 | AC | 1 ms
6,816 KB |
testcase_41 | AC | 7 ms
6,816 KB |
testcase_42 | AC | 8 ms
6,816 KB |
testcase_43 | AC | 3 ms
6,816 KB |
testcase_44 | AC | 2 ms
6,820 KB |
testcase_45 | AC | 2 ms
6,816 KB |
testcase_46 | AC | 2 ms
6,816 KB |
testcase_47 | AC | 2 ms
6,816 KB |
testcase_48 | AC | 1 ms
6,816 KB |
testcase_49 | AC | 1 ms
6,816 KB |
ソースコード
#include <stdio.h> int main () { int t = 0; int res = 0; res = scanf("%d", &t); while (t > 0) { int a = 0; int b = 0; int c = 0; long long x = 0LL; long long y = 0LL; long long z = 0LL; long long w = 0LL; long long ans = 0LL; res = scanf("%d", &a); res = scanf("%d", &b); res = scanf("%d", &c); res = scanf("%lld", &x); res = scanf("%lld", &y); res = scanf("%lld", &z); res = scanf("%lld", &w); for (int i = 0; (i <= a && i <= b && i <= c); i++) { long long tmp = 0LL; if (2LL*w >= x+y+z) { tmp = w*((long long)i); } else { tmp = w*((long long)(i%2))+(x+y+z)*((long long)(i/2)); } if (x > y) { long long tmptmp = 0LL; if (a > b) { tmptmp = x*((long long)(b-i)); } else { tmptmp = x*((long long)(a-i)); if (b-a < c-i) { tmptmp += y*((long long)(b-a)); } else { tmptmp += y*((long long)(c-i)); } } if (tmp+tmptmp > ans) { ans = tmp+tmptmp; } } else { long long tmptmp = 0LL; if (c > b) { tmptmp = y*((long long)(b-i)); } else { tmptmp = y*((long long)(c-i)); if (b-c < a-i) { tmptmp += x*((long long)(b-c)); } else { tmptmp += x*((long long)(a-i)); } } if (tmp+tmptmp > ans) { ans = tmp+tmptmp; } } if (y > z) { long long tmptmp = 0LL; if (b > c) { tmptmp = y*((long long)(c-i)); } else { tmptmp = y*((long long)(b-i)); if (c-b < a-i) { tmptmp += z*((long long)(c-b)); } else { tmptmp += z*((long long)(a-i)); } } if (tmp+tmptmp > ans) { ans = tmp+tmptmp; } } else { long long tmptmp = 0LL; if (a > c) { tmptmp = z*((long long)(c-i)); } else { tmptmp = z*((long long)(a-i)); if (c-a < b-i) { tmptmp += y*((long long)(c-a)); } else { tmptmp += y*((long long)(b-i)); } } if (tmp+tmptmp > ans) { ans = tmp+tmptmp; } } if (z > x) { long long tmptmp = 0LL; if (c > a) { tmptmp = z*((long long)(a-i)); } else { tmptmp = z*((long long)(c-i)); if (a-c < b-i) { tmptmp += x*((long long)(a-c)); } else { tmptmp += x*((long long)(b-i)); } } if (tmp+tmptmp > ans) { ans = tmp+tmptmp; } } else { long long tmptmp = 0LL; if (b > a) { tmptmp = x*((long long)(a-i)); } else { tmptmp = x*((long long)(b-i)); if (a-b < c-i) { tmptmp += z*((long long)(a-b)); } else { tmptmp += z*((long long)(c-i)); } } if (tmp+tmptmp > ans) { ans = tmp+tmptmp; } } } printf("%lld\n", ans); t--; } return 0; }