QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#798753#9653. Bin Packingjiangly (Lingyu Jiang)WA 0ms3612kbC++231.4kb2024-12-04 16:46:322024-12-04 16:46:33

Judging History

This is the latest submission verdict.

  • [2024-12-04 16:46:33]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 3612kb
  • [2024-12-04 16:46:32]
  • Submitted

answer

#include <bits/stdc++.h>

using i64 = long long;

void solve() {
    std::array<int, 6> a;
    for (int i = 1; i <= 5; i++) {
        std::cin >> a[i];
    }
    
    int ans = 0;
    int t = std::min(a[1], a[5]);
    a[1] -= t;
    a[5] -= t;
    ans += t;
    t = std::min(a[2], a[4]);
    a[2] -= t;
    a[4] -= t;
    ans += t;
    t = a[3] / 2;
    a[3] -= 2 * t;
    ans += t;
    
    if (a[5] == 0) {
        if (a[4] == 0) {
            ans += (1LL * a[1] + 2LL * a[2] + 3LL * a[3]) / 6;
        } else if (a[1] >= 3LL * a[3] + 2LL * a[4]) {
            ans += (1LL * a[1] + 3LL * a[3] + 4LL * a[4]) / 6;
        } else {
            ans += std::min(a[4], (a[1] + a[3] + a[4]) / 3);
        }
    } else {
        if (a[3] == 1) {
            a[3]--;
            a[5]--;
            ans++;
        }
        if (a[4] == 0) {
            if (a[2] >= a[5]) {
                ans += a[5] + (a[2] - a[5]) / 3;
            } else {
                ans += (a[2] + a[5]) / 2;
            }
        } else {
            if (a[4] >= a[5]) {
                ans += a[5] + (a[4] - a[5]) / 3;
            } else {
                ans += (a[4] + a[5]) / 2;
            }
        }
    }
    
    std::cout << ans << "\n";
}

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    
    int t;
    std::cin >> t;
    
    while (t--) {
        solve();
    }
    
    return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3612kb

input:

100
9 6 8 7
8 10 7 5
8 10 5 8
10 6 8 10
5 5 10 10
6 9 7 5
5 6 10 9
9 10 5 5
6 7 9 5
9 6 10 10
8 8 10 5
9 8 10 5
5 7 9 6
9 8 8 8
7 8 10 9
8 9 9 9
7 7 6 5
8 10 7 9
8 6 5 8
10 5 9 10
6 10 7 10
6 6 8 10
8 9 7 8
6 10 10 5
6 8 10 5
5 9 9 10
6 10 10 8
8 6 6 6
6 6 9 6
5 8 8 7
6 5 9 7
8 10 6 7
8 7 7 5
79 99 ...

output:

18
19
18
19
15
22
16
20
19
16
19
20
20
18
16
21
19
20
20
16
19
19
16
16
17
18
116
177
188
186
153
172
200
175
173
171
179
164
168
200
170
176
191
162
183
189
178
210
189
182
167
187
467
1587
1644
1502
1673
1465
1691
2112
1855
1941
2027
2019
1814
1804
2110
1785
2088
1476
1739
1572
1845
1461
1623
2111...

result:

wrong answer 1st lines differ - expected: 'Case 1: 1', found: '18'