QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#563589 | #8783. Cherry Picking | donghanwen1225 | Compile Error | / | / | C++20 | 464b | 2024-09-14 14:02:22 | 2024-09-14 14:02:23 |
Judging History
answer
#include<iostream>
#include<cstdio>
using namespace std;
int n,k,r[100005];char s[100005];
int main()
{
cin>>n>>k;
for(int i=1;i<=n;i++) cin>>r[i];
cin>>s;
int l=1,r=100000,ans=0;
while(l<=r)
{
int mid=(l+r)/2;
int cl=0,ok=0;
for(int i=1;i<=n;i++)
if(r[i]>=mid)
{
if(s[i-1]=='0') cl=0;
else
{
cl++;
if(cl==k) ok=1;
}
}
if(ok) ans=mid,l=mid+1;
else r=mid-1;
}
cout<<ans;
return 0;
}
Details
answer.code: In function ‘int main()’: answer.code:16:29: error: invalid types ‘int[int]’ for array subscript 16 | if(r[i]>=mid) | ^