Submission #1087949

#TimeUsernameProblemLanguageResultExecution timeMemory
1087949vicvicTake-out (POI13_usu)C++11
22 / 100
135 ms42940 KiB
#include <iostream> #include <fstream> #include <vector> #include <string> #include <cstring> 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--; } } 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)

usu.cpp: In function 'int main()':
usu.cpp:22:31: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   22 |             while (v[p].size()==k+1)
      |                    ~~~~~~~~~~~^~~~~
#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...