QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#343321#8284. Cats and Fishmendicillin2#WA 1ms3864kbC++17724b2024-03-02 13:57:182024-03-02 13:57:18

Judging History

This is the latest submission verdict.

  • [2024-03-02 13:57:18]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 3864kb
  • [2024-03-02 13:57:18]
  • Submitted

answer

#include<bits/stdc++.h>
using namespace std;

inline int read()
{
	int x=0,f=1;
	char c=getchar();
	while(c<'0' || c>'9')
	{
		if(c=='-') f=-1;
		c=getchar();
	}
	while(c>='0' && c<='9')
	{
		x=x*10+c-'0';
		c=getchar();
	}
	return x*f;
}

int n,m,x;
int a[105];
int last[105];

int main()
{
	m=read(); n=read(); x=read();
	for(int i=1;i<=n;i++) a[i]=read();
	sort(a+1,a+n+1);
	for(int i=1;i<=n;i++) last[i]=-1e9;
	for(int i=0;i<=x;i++)
	{
		for(int j=1;j<=n;j++)
		{
			if(i-last[j]>=a[i] && m)
				m--, last[j]=i;
		}
	}
	int ans1=m, ans2=0;
	for(int i=1;i<=n;i++)
	{
		if(x-last[i]==0) ans1++;
		else if(x-last[i]<a[i]) ans2++;
	}
	printf("%d %d\n",ans1,ans2);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2 1 1
1

output:

1 0

result:

ok 2 number(s): "1 0"

Test #2:

score: 0
Accepted
time: 0ms
memory: 3736kb

input:

8 3 5
1 3 4

output:

0 1

result:

ok 2 number(s): "0 1"

Test #3:

score: 0
Accepted
time: 1ms
memory: 3760kb

input:

4 5 1
5 4 3 2 1

output:

0 3

result:

ok 2 number(s): "0 3"

Test #4:

score: 0
Accepted
time: 0ms
memory: 3748kb

input:

1 1 10
1

output:

0 0

result:

ok 2 number(s): "0 0"

Test #5:

score: -100
Wrong Answer
time: 0ms
memory: 3796kb

input:

14 3 10
1 40 50

output:

0 2

result:

wrong answer 1st numbers differ - expected: '2', found: '0'