QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#644591 | #9470. Cats and Fish | Afterlife# | WA | 0ms | 3644kb | C++20 | 1.0kb | 2024-10-16 14:42:46 | 2024-10-16 14:42:47 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N=5e3+1e2+7;
int T,n,m,c[N],x;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
while(cin>>m>>n>>x)
{
vector<set<int> >v(x+1);
for(int i=1;i<=n;i++)
cin>>c[i];
sort(c+1,c+n+1);
int cmp=0,icmp=0;
for(int i=1;i<=n;i++)
{
if(m)
{
if(c[i]<=x)
v[c[i]].insert(c[i]);
if(x!=0)
{
icmp++;
m--;
}
}
}
for(int i=1;i<=x;i++)
{
for(auto c:v[i])
{
cmp++;
icmp--;
if(m&&i<x)
{
m--;
icmp++;
if(i+c<=x)
v[i+c].insert(c);
}
}
}
cout<<m<<" "<<icmp<<"\n";
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3636kb
input:
2 1 1 1 8 3 5 1 3 4 4 5 1 5 4 3 2 1
output:
1 0 0 1 0 3
result:
ok 3 lines
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3644kb
input:
1 1 10 1 14 3 10 1 40 50 8 2 7 12 13 1 1 1 2 12 2 11 8 3 2 2 12 24 1 562 8 232 17 26 800 12 77 32 11 2 562 8 1 17 26 800 12 77 32 11 1 3656 13 123 1887 26 800 12 77 32 11 1 77 32 77 32 155
output:
0 0 2 2 6 2 0 1 6 2 0 1 368 7 554 7 3492 12
result:
wrong answer 9th lines differ - expected: '3484 12', found: '3492 12'