QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#774196 | #9470. Cats and Fish | surenjamts# | AC ✓ | 0ms | 3604kb | C++20 | 988b | 2024-11-23 12:23:43 | 2024-11-23 12:23:47 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
int m,n,x;
while(cin>>m>>n>>x){
int t=m;
int a[n];
vector<int> v[x+5];
vector<int> cnt(x+5);
for(int i=0; i<n; i++){
cin>>a[i];
}
sort(a,a+n);
for(int i=0; i<n; i++){
v[0].push_back(a[i]);
}
int fi=0, se=0;
for(int i=0; i<x; i++){
sort(v[i].begin(),v[i].end());
for(int j: v[i]){
if(t==0) break;
t--;
if(i+j<=x){
v[i+j].push_back(j);
fi++;
}
else se++;
}
}
//cout<<"PISDA"<<fi<<" "<<se<<endl;
if(fi>=m){
cout<<0<<" "<<se<<endl;
}
else{
cout<<m-fi-se<<" "<<se<<endl;
}
//cout<<fi<<" "<<se-fi<<endl;
}
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3544kb
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: 0
Accepted
time: 0ms
memory: 3604kb
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 3484 12
result:
ok 9 lines