QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#545485#8777. Passport StampsCCF_NOI#WA 10ms4976kbC++20442b2024-09-03 13:59:332024-09-03 13:59:33

Judging History

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

  • [2024-09-03 13:59:33]
  • 评测
  • 测评结果:WA
  • 用时:10ms
  • 内存:4976kb
  • [2024-09-03 13:59:33]
  • 提交

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'