QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#545511 | #8777. Passport Stamps | CCF_NOI# | WA | 4ms | 3820kb | C++20 | 377b | 2024-09-03 14:27:14 | 2024-09-03 14:27:15 |
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);
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';
}
Details
Tip: Click on the bar to expand more detailed information
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'