QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#343321 | #8284. Cats and Fish | mendicillin2# | WA | 1ms | 3864kb | C++17 | 724b | 2024-03-02 13:57:18 | 2024-03-02 13:57:18 |
Judging History
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;
}
詳細信息
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'