QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#545511#8777. Passport StampsCCF_NOI#WA 4ms3820kbC++20377b2024-09-03 14:27:142024-09-03 14:27:15

Judging History

This is the latest submission verdict.

  • [2024-09-03 14:27:15]
  • Judged
  • Verdict: WA
  • Time: 4ms
  • Memory: 3820kb
  • [2024-09-03 14:27:14]
  • Submitted

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);
	for(int i=0;i<n;i++)cin>>a[i];
	sort(a.begin(),a.end());
	int ans=0;
	while(ans<n)
	{
		if(p<a[ans])break;
		if(ans==n-1)p-=a[ans];
		else p-=a[ans]+a[ans+1]-1;
		ans++;
	}
	cout<<ans<<'\n';
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3820kb

input:

5 15
1
2
3
4
5

output:

3

result:

ok single line: '3'

Test #2:

score: -100
Wrong Answer
time: 4ms
memory: 3800kb

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'