Submission #1087973

#TimeUsernameProblemLanguageResultExecution timeMemory
1087973vicvicTake-out (POI13_usu)C++11
0 / 100
113 ms37204 KiB
#include <iostream> #include <fstream> #include <vector> #include <string> #include <cstring> #include <cassert> using namespace std; int n, k, cnt=0, durdur=0; string input; int p[500005]; vector <int> v[500005]; int main() { cin >> n >> k; cin >> input; input=" "+input; for (int i=1;i<=n;i++) { if (input[i]=='c') { cnt++; p[cnt]=0; } else { p[cnt]++; } if (cnt && p[cnt]+p[cnt-1]>=k) { durdur++; for (int j=i-k;j<=i;j++) { v[durdur].push_back (j); } int ant=p[cnt--]; p[cnt]-=k-ant; } } for (int i=n/(k+1);i>=1;i--) { for (auto itr : v[i]) { cout << itr << " "; } cout << "\n"; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...