QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#863138#9717. Defuse the BombsIllusionaryDominance#WA 24ms4336kbC++20787b2025-01-19 13:37:322025-01-19 13:37:33

Judging History

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

  • [2025-01-19 13:37:33]
  • 评测
  • 测评结果:WA
  • 用时:24ms
  • 内存:4336kb
  • [2025-01-19 13:37:32]
  • 提交

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<ll> a(n);
        for (auto &x : a) cin >> x;
        
        ll l = 1, r = (ll)(1e18), ans = 0;
        while (l <= r)
        {
            ll mid = (l + r) >> 1;
            ll cnt = 0;
            for (auto x : a)
            {
                cnt += max(0ll, mid - x);
            }
            if (cnt <= mid) ans = mid, l = mid + 1;
            else r = mid - 1;
        }
        cout << ans + 1 << "\n";
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
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: 24ms
memory: 4336kb

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: 871063966299720496
Case #2: 871063966299944245
Case #3: 871063966299209723

result:

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