QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#839651#9717. Defuse the Bombsjiangzhihui#WA 0ms3528kbC++14709b2025-01-01 23:18:352025-01-01 23:18:36

Judging History

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

  • [2025-01-01 23:18:36]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3528kb
  • [2025-01-01 23:18:35]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
void solve(int idx){
    int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
        a[i]++;
    }
    auto check=[&](ll mid){
        ll res=0;
        for(int i=0;i<n;i++){
            if(mid>a[i])res+=mid-a[i];
        }
        return res<mid;
    };
    ll l=1,r=1e14;
    while(l<=r){
        ll mid=(l+r)>>1;
        if(check(mid))l=mid+1;
        else r=mid-1;
    }
    cout<<r<<'\n';
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int T;
    cin>>T;
    int idx=1;
    while(T--){
        solve(idx++);
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2
2
1 1
3
1 2 3

output:

3
4

result:

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