QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#741182#9717. Defuse the Bombsxjt05#WA 0ms3688kbC++232.0kb2024-11-13 13:42:552024-11-13 13:42:56

Judging History

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

  • [2024-11-13 13:42:56]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3688kb
  • [2024-11-13 13:42:55]
  • 提交

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;
    }
}

详细

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'