제출 #1087954

#제출 시각아이디문제언어결과실행 시간메모리
1087954vicvic새로운 문제 (POI13_usu)C++11
22 / 100
123 ms42860 KiB
#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; }

컴파일 시 표준 에러 (stderr) 메시지

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