QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#545485 | #8777. Passport Stamps | CCF_NOI# | WA | 10ms | 4976kb | C++20 | 442b | 2024-09-03 13:59:33 | 2024-09-03 13:59:33 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int n;
ll p;
cin>>n>>p;
vector<ll>a(n);
priority_queue<ll>q;
for(int i=0;i<n;i++)cin>>a[i];
sort(a.begin(),a.end());
q.push(p);
int ans=0;
while(ans<n)
{
if(q.top()<a[ans])break;
ll x=q.top();
q.pop();
x-=a[ans];
q.push(x>>1);
q.push(x+1>>1);
ans++;
}
cout<<ans<<'\n';
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3572kb
input:
5 15 1 2 3 4 5
output:
3
result:
ok single line: '3'
Test #2:
score: -100
Wrong Answer
time: 10ms
memory: 4976kb
input:
100000 559309580160692839 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
99999
result:
wrong answer 1st lines differ - expected: '84437', found: '99999'