# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1087954 | vicvic | Take-out (POI13_usu) | C++11 | 123 ms | 42860 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 <fstream>
#include <vector>
#include <string>
#include <cstring>
#include <cassert>
using namespace std;
int n, k, cnt=0, p=0;
string input;
int frecv[500005][3];
vector <int> v[500005];
int main()
{
cin >> n >> k;
cin >> input;
input=" "+input;
for (int i=1;i<=n;i++)
{
if (p!=0 && ((input[i]=='b' && frecv[p][0]<k) || (input[i]=='c' && frecv[p][1]==0)))
{
frecv[p][input[i]-'b']++;
v[p].push_back (i);
while (v[p].size()==k+1 && p>0)
{
p--;
}
}
else
{
cnt++;
p=cnt;
frecv[p][input[i]-'b']++;
v[p].push_back (i);
}
}
for (int i=1;i<=n/(k+1);i++)
{
for (auto itr : v[i])
{
cout << itr << " ";
}
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... |