답안 #907456

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
907456 2024-01-15T15:55:46 Z Petrix Take-out (POI13_usu) C++17
100 / 100
129 ms 42856 KB
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int sp[1000001],poz1[1000001];
vector<vector<int>> rasp;

int main()
{
    string s,s1;
    int n,k,poz,cnt,i,j;
    cin>>n>>k>>s1;rasp.resize(n/(k+1));
    s=' ';s+=s1;
    poz=cnt=0;
    for(i=1;i<s.size();i++){
        poz++;
        sp[poz]=sp[poz-1]+(s[i]=='c');
        poz1[poz]=i;
        if(poz>=k+1 && sp[poz]-sp[poz-k-1]==1){
            for(j=poz-k;j<=poz;j++){
                rasp[cnt].push_back(poz1[j]);
            }//printf("a");
            cnt++;
            poz-=(k+1);
        }
    }
    for(i=cnt-1;i>=0;i--){
        for(j=0;j<rasp[i].size();j++){
            cout<<rasp[i][j]<<" ";
        }
        cout<<"\n";
    }
    return 0;
}

Compilation message

usu.cpp: In function 'int main()':
usu.cpp:16:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |     for(i=1;i<s.size();i++){
      |             ~^~~~~~~~~
usu.cpp:29:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |         for(j=0;j<rasp[i].size();j++){
      |                 ~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 540 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 556 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 5284 KB Output is correct
2 Correct 10 ms 4244 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 30 ms 8676 KB Output is correct
2 Correct 24 ms 8696 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 46 ms 12708 KB Output is correct
2 Correct 26 ms 9312 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 65 ms 16428 KB Output is correct
2 Correct 72 ms 16392 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 129 ms 42856 KB Output is correct
2 Correct 86 ms 22828 KB Output is correct
3 Correct 85 ms 19268 KB Output is correct
4 Correct 90 ms 20160 KB Output is correct