Submission #579793

#TimeUsernameProblemLanguageResultExecution timeMemory
579793AlperenTZalmoxis (BOI18_zalmoxis)C++17
5 / 100
171 ms10588 KiB
#include <bits/stdc++.h> using namespace std; int n, k, x; deque<int> a, b; vector<int> lft, rght; int main(){ ios_base::sync_with_stdio(false);cin.tie(NULL); cin >> n >> k; for(int i = 1; i <= n; i++){ cin >> x; b.push_back(x); } a.push_back(30); while(lft.size() + rght.size() + a.size() < n + k){ if(!b.empty() && a.front() == b.front() && lft.size() + rght.size() + a.size() < n + k){ lft.push_back(a.front()); a.pop_front(); b.pop_front(); } if(a.front() == 1){ lft.push_back(a.front()); a.pop_front(); } if(!b.empty() && a.back() == b.back() && lft.size() + rght.size() + a.size() < n + k){ rght.push_back(a.back()); a.pop_back(); b.pop_back(); } if(a.back() == 1){ rght.push_back(a.back()); a.pop_back(); } if(a.front() != 1 && lft.size() + rght.size() + a.size() < n + k){ int x = a.front(); a.pop_front(); a.push_front(x - 1); a.push_front(x - 1); } if(a.back() != 1 && lft.size() + rght.size() + a.size() < n + k){ int x = a.back(); a.pop_back(); a.push_back(x - 1); a.push_back(x - 1); } } reverse(rght.begin(), rght.end()); for(auto i : lft) cout << i << " "; for(auto i : a) cout << i << " "; for(auto i : rght) cout << i << " "; }

Compilation message (stderr)

zalmoxis.cpp: In function 'int main()':
zalmoxis.cpp:24:44: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   24 |  while(lft.size() + rght.size() + a.size() < n + k){
      |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
zalmoxis.cpp:25:82: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   25 |   if(!b.empty() && a.front() == b.front() && lft.size() + rght.size() + a.size() < n + k){
      |                                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
zalmoxis.cpp:37:80: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   37 |   if(!b.empty() && a.back() == b.back() && lft.size() + rght.size() + a.size() < n + k){
      |                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
zalmoxis.cpp:49:60: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   49 |   if(a.front() != 1 && lft.size() + rght.size() + a.size() < n + k){
      |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
zalmoxis.cpp:58:59: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   58 |   if(a.back() != 1 && lft.size() + rght.size() + a.size() < n + k){
      |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...