Submission #843054

#TimeUsernameProblemLanguageResultExecution timeMemory
843054Elvin_FritlZalmoxis (BOI18_zalmoxis)C++17
0 / 100
170 ms8824 KiB
#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 (stderr)

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++){
      |                 ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...