QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#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';
}
详细
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'