# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
83496 | nikolapesic2802 | Take-out (POI13_usu) | C++14 | 501 ms | 60344 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
int main()
{
int n,k;
scanf("%i %i",&n,&k);
char s[n];
scanf("%s",s);
int i=0,j=n-1;
while(i<=j)
{
set<int> index;
int c=1,b=k;
for(int l=0;l<k+1;l++)
{
index.insert(i);
if(s[i]=='c')
c--;
else
b--;
i++;
}
i--;
while(c!=0||b!=0)
{
index.insert(j);
if(s[j]=='c')
c--;
else
b--;
if(s[i]=='c')
c++;
else
b++;
index.erase(i);
i--;
j--;
}
i++;
for(auto p:index)
{
printf("%i ",p+1);
}
printf("\n");
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |