# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
82672 | farukkastamonuda | Take-out (POI13_usu) | C++14 | 230 ms | 40744 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>
#define fi first
#define se second
#define lo long long
#define inf 1000000009
#define md 1000000007
#define li 1000005
#define mp make_pair
#define pb push_back
using namespace std;
int n,k,cev,bas1,bas2,c;
char s[li];
vector<int> v,p;
vector< vector<int> > ans;
int main(){
scanf("%d %d",&n,&k);
scanf("%s",s+1);
p.pb(0);
for(int i=1;i<=n;i++){
v.pb(i);
if(s[i]=='c'){
c++;
p.pb(0);
}
else p[c]++;
if(c && p[c]+p[c-1]>=k){
vector<int> T;
for(int j=1;j<=k+1;j++){
T.pb(v.back());
v.pop_back();
}
int X=k-p[c];
c--;
p[c]-=X;
p.pop_back();
reverse(T.begin(),T.end());
ans.pb(T);
}
}
for(int i=0;i<(int)ans.size();i++){
for(int j=0;j<(int)ans[i].size();j++){
printf("%d ",ans[i][j]);
}
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... |