제출 #759042

#제출 시각아이디문제언어결과실행 시간메모리
759042Charizard2021새로운 문제 (POI13_usu)C++17
100 / 100
156 ms39040 KiB
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; string s; cin >> s; vector<int> val; vector<int> x; x.push_back(0); int cVal = 0; vector<vector<int> > ans; for(int i = 0; i < n; i++){ val.push_back(i); if(s[i] == 'c'){ x.push_back(0); cVal++; } else{ x[cVal]++; } if(cVal != 0 && x[cVal] + x[cVal - 1] >= k){ vector<int> v2; ans.push_back(v2); for(int j = 0; j <= k; j++){ ans[(int)ans.size() - 1].push_back(val[(int)val.size() - 1]); val.pop_back(); } int difference = x[cVal]; cVal--; x.pop_back(); x[cVal] -= (k - difference); } } reverse(ans.begin(), ans.end()); for(int i = 0; i < ans.size(); i++){ for(int j = ans[i].size() - 1; j >= 0; j--){ cout << ans[i][j] + 1 << " "; } cout << "\n"; } }

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

usu.cpp: In function 'int main()':
usu.cpp:36:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |     for(int i = 0; i < ans.size(); i++){
      |                    ~~^~~~~~~~~~~~
#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...