QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#839651 | #9717. Defuse the Bombs | jiangzhihui# | WA | 0ms | 3528kb | C++14 | 709b | 2025-01-01 23:18:35 | 2025-01-01 23:18:36 |
Judging History
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'