제출 #1087997

#제출 시각아이디문제언어결과실행 시간메모리
1087997AndrijaM새로운 문제 (POI13_usu)C++14
100 / 100
135 ms38120 KiB
#include <iostream> #include <fstream> #include <vector> #include <string> #include <cstring> #include <cassert> using namespace std; int n, k, cnt=0, durdur=0, sz=0; int input[1000005]; int p[500005]; vector <int> v[500005]; int main() { cin >> n >> k; for (int i=1;i<=n;i++) { char a; cin >> a; input[++sz]=i; if (a=='c') { cnt++; p[cnt]=0; } else { p[cnt]++; } if (cnt && p[cnt]+p[cnt-1]>=k) { durdur++; for (int j=sz-k;j<=sz;j++) { v[durdur].push_back (input[j]); } sz-=k+1; 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...