QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#800661 | #9798. Safety First | Yo1o | WA | 1ms | 3788kb | C++17 | 734b | 2024-12-06 14:08:05 | 2024-12-06 14:08:06 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> PII;
const int N = 1e6 + 10;
const ll INF = 1e6 + 10;
bool cmp(string x,string y)
{
return x.size() < y.size();
}
void solve()
{
ll n,m;
cin>>n>>m;
string s[n + 10];
for(int i = 1;i <= n;i++)
{
cin>>s[i];
}
//sort(s + 1,s + 1 + n,cmp);
ll res = 0;
for(int i = 1;i <= n;i++)
{
if(m >= s[i].size())
{
m -= s[i].size();
res++;
}
else
{
break;
}
}
cout<<res<<'\n';
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int T = 1;
cin>>T;
while(T--)
{
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3788kb
input:
3 1 3 2 3 3 3
output:
1 3 3
result:
wrong answer 2nd numbers differ - expected: '4', found: '3'