QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#741182 | #9717. Defuse the Bombs | xjt05# | WA | 0ms | 3688kb | C++23 | 2.0kb | 2024-11-13 13:42:55 | 2024-11-13 13:42:56 |
Judging History
answer
#include<iostream>
#include<queue>
#include<map>
#include<set>
#include<vector>
#include<algorithm>
#include<deque>
#include<cctype>
#include<string.h>
#include<math.h>
#include<time.h>
#include<random>
#include<stack>
#include<string>
#define ll long long
#define lowbit(x) (x & -x)
#define endl "\n"// 交互题记得删除
using namespace std;
mt19937 rnd(time(0));
const ll mod = 998244353;
ll ksm(ll x, ll y)
{
ll ans = 1;
while (y)
{
if (y & 1)
{
ans = ans % mod * (x % mod) % mod;
}
x = x % mod * (x % mod) % mod;
y >>= 1;
}
return ans % mod % mod;
}
ll gcd(ll x, ll y)
{
if (y == 0)
return x;
else
return gcd(y, x % y);
}
void fio()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}
// inline ll read()
// {
// ll x=0,f=1;
// char ch=getchar();
// while(ch<'0'||ch>'9')
// {
// if(ch=='-')
// f=-1;
// ch=getchar();
// }
// while(ch>='0' && ch<='9')
// x=x*10+ch-'0',ch=getchar();
// return x*f;
// }
ll a[250000];
int main()
{
fio();
ll t; ll gs=0;
cin>>t;
while(t--)
{
ll n;
cin>>n;
gs++;
for(ll i=1;i<=n;i++)cin>>a[i];
ll l=0,r=(ll)1e18;
while(l<=r)
{
ll mid=(l+r)>>1;
ll cnt=mid;
priority_queue<ll>q;
ll pd=0;
for(ll i=1;i<=n;i++)
{
if(a[i]-mid>=0)continue;
else
{
if(cnt+a[i]-mid>=0)
{
cnt+=(a[i]-mid);
}
else
{
pd=1;
}
}
}
if(pd)
r=mid-1;
else
l=mid+1;
}
cout<<"Case"<<" #"<<gs<<" "<<r+1<<endl;
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3688kb
input:
2 2 1 1 3 1 2 3
output:
Case #1 3 Case #2 4
result:
wrong answer 1st lines differ - expected: 'Case #1: 3', found: 'Case #1 3'