# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
907456 | Petrix | Take-out (POI13_usu) | C++17 | 129 ms | 42856 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 <iostream>
#include <string>
#include <vector>
using namespace std;
int sp[1000001],poz1[1000001];
vector<vector<int>> rasp;
int main()
{
string s,s1;
int n,k,poz,cnt,i,j;
cin>>n>>k>>s1;rasp.resize(n/(k+1));
s=' ';s+=s1;
poz=cnt=0;
for(i=1;i<s.size();i++){
poz++;
sp[poz]=sp[poz-1]+(s[i]=='c');
poz1[poz]=i;
if(poz>=k+1 && sp[poz]-sp[poz-k-1]==1){
for(j=poz-k;j<=poz;j++){
rasp[cnt].push_back(poz1[j]);
}//printf("a");
cnt++;
poz-=(k+1);
}
}
for(i=cnt-1;i>=0;i--){
for(j=0;j<rasp[i].size();j++){
cout<<rasp[i][j]<<" ";
}
cout<<"\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... |