제출 #101318

#제출 시각아이디문제언어결과실행 시간메모리
101318MohamedAhmed0새로운 문제 (POI13_usu)C++14
100 / 100
343 ms37912 KiB
#include <bits/stdc++.h> using namespace std ; const int MAX = 1000000 ; int arr[MAX] ; int main() { int n , k ; cin>>n>>k ; string s ; cin>>s ; int cnt = 0 ; vector<int>v ; vector< vector<int> >ans ; for(int i = 0 ; i < n ; ++i) { v.push_back(i) ; if(s[i] == 'b') arr[cnt]++ ; else if(s[i] == 'c') cnt++ ; if(cnt == 0) continue ; if(arr[cnt] + arr[cnt-1] >= k) { int s = v.size()-k-1 ; vector<int>tmp ; for(int j = s ; j <= s+k ; ++j) tmp.push_back(v[j]) ; for(int j = 0 ; j < k+1 ; ++j) v.pop_back() ; int need = min(k , arr[cnt]) ; ans.push_back(tmp) ; arr[cnt] -= need ; --cnt ; arr[cnt] -= (k-need) ; } } reverse(ans.begin() , ans.end()) ; for(int i = 0 ; i < ans.size() ; ++i) { for(int j = 0 ; j < ans[i].size() ; ++j) cout<<ans[i][j]+1<<" "; cout<<"\n"; } return 0 ; }

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

usu.cpp: In function 'int main()':
usu.cpp:42:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0 ; i < ans.size() ; ++i)
                  ~~^~~~~~~~~~~~
usu.cpp:44:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int j = 0 ; j < ans[i].size() ; ++j)
                   ~~^~~~~~~~~~~~~~~
#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...