QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#863132#9717. Defuse the BombsIllusionaryDominance#WA 39ms4200kbC++20844b2025-01-19 13:28:492025-01-19 13:28:50

Judging History

你现在查看的是最新测评结果

  • [2025-01-19 13:28:50]
  • 评测
  • 测评结果:WA
  • 用时:39ms
  • 内存:4200kb
  • [2025-01-19 13:28:49]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#define all(x) (x).begin(), (x).end()
using ll = long long;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
    int T;
    cin >> T;
    for (int i = 1; i <= T; ++i)
    {
        cout << "Case #" << i << ": ";
        int n; cin >> n;
        vector<int> a(n);
        for (auto &x : a) cin >> x;
        sort(all(a));
        
        ll l = 1, r = (ll)(1e15), ans = 0;
        while (l <= r)
        {
            ll mid = (l + r) >> 1;
            ll cnt = 0;
            for (auto x : a)
            {
                if (x >= mid) break;
                else cnt += mid - x;
            }
            if (cnt <= mid) ans = mid, l = mid + 1;
            else r = mid - 1;
        }
        cout << ans + 1 << "\n";
    }
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3712kb

input:

2
2
1 1
3
1 2 3

output:

Case #1: 3
Case #2: 4

result:

ok 2 lines

Test #2:

score: -100
Wrong Answer
time: 39ms
memory: 4200kb

input:

3
100000
968870229 246637522 23867348 170512761 317727561 135784257 788061221 6692201 96102115 164513402 826612817 675345177 690177641 969959105 957765211 678805726 936166573 281739681 760822473 521447491 619742216 102531432 633299481 698320991 55968513 399427883 808303141 53228160 432641457 7250014...

output:

Case #1: 553408355787316
Case #2: 553408356011065
Case #3: 553408355276543

result:

wrong answer 1st lines differ - expected: 'Case #1: 2', found: 'Case #1: 553408355787316'