답안 #843054

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
843054 2023-09-03T15:32:46 Z Elvin_Fritl Zalmoxis (BOI18_zalmoxis) C++17
0 / 100
170 ms 8824 KB
#include <bits/stdc++.h>
using namespace std;

const int N = 505 , inf = 1e9 + 199;

int n,k;

vector<int>v;

void func(int ed)
{
    if(ed == 0 || k == 0){
        v.push_back(ed);
        return;
    }
    k--;
    func(ed - 1);
    func(ed - 1);
}

int32_t main()
{
    cin>>n>>k;
    for(int i=0;i<n;i++){
        int ed;
        cin>>ed;
        if(k > 0){
            func(ed);
        }
        else{
            v.push_back(ed);
        }
    }
    for(int i=0;i<v.size();i++){
        cout<<v[i]<<" ";
    }
}
/*

1 1    2 2    3 3    4 4
1


*/

Compilation message

zalmoxis.cpp: In function 'int32_t main()':
zalmoxis.cpp:34:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |     for(int i=0;i<v.size();i++){
      |                 ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 158 ms 8496 KB doesn't contain S as a subsequence
2 Incorrect 168 ms 8504 KB doesn't contain S as a subsequence
3 Incorrect 162 ms 8376 KB doesn't contain S as a subsequence
4 Incorrect 159 ms 8376 KB doesn't contain S as a subsequence
5 Incorrect 160 ms 8632 KB doesn't contain S as a subsequence
6 Incorrect 167 ms 8332 KB doesn't contain S as a subsequence
# 결과 실행 시간 메모리 Grader output
1 Incorrect 159 ms 8424 KB doesn't contain S as a subsequence
2 Incorrect 167 ms 8824 KB doesn't contain S as a subsequence
3 Incorrect 162 ms 8376 KB doesn't contain S as a subsequence
4 Incorrect 170 ms 8728 KB doesn't contain S as a subsequence
5 Incorrect 161 ms 8560 KB doesn't contain S as a subsequence
6 Incorrect 168 ms 8548 KB doesn't contain S as a subsequence
7 Incorrect 159 ms 8380 KB doesn't contain S as a subsequence
8 Incorrect 168 ms 8632 KB doesn't contain S as a subsequence
9 Incorrect 148 ms 8124 KB doesn't contain S as a subsequence
10 Incorrect 90 ms 6920 KB doesn't contain S as a subsequence
11 Incorrect 110 ms 7356 KB doesn't contain S as a subsequence
12 Incorrect 0 ms 348 KB Unexpected end of file - int32 expected
13 Incorrect 0 ms 348 KB Unexpected end of file - int32 expected
14 Incorrect 0 ms 348 KB Unexpected end of file - int32 expected