Submission #579793

# Submission time Handle Problem Language Result Execution time Memory
579793 2022-06-19T21:23:15 Z AlperenT Zalmoxis (BOI18_zalmoxis) C++17
5 / 100
171 ms 10588 KB
#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

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 time Memory Grader output
1 Incorrect 160 ms 10560 KB doesn't contain S as a subsequence
2 Incorrect 133 ms 10524 KB doesn't contain S as a subsequence
3 Incorrect 140 ms 10472 KB doesn't contain S as a subsequence
4 Incorrect 133 ms 10472 KB doesn't contain S as a subsequence
5 Incorrect 136 ms 10472 KB doesn't contain S as a subsequence
6 Incorrect 150 ms 10408 KB doesn't contain S as a subsequence
# Verdict Execution time Memory Grader output
1 Incorrect 133 ms 10544 KB doesn't contain S as a subsequence
2 Incorrect 161 ms 10484 KB doesn't contain S as a subsequence
3 Incorrect 134 ms 10500 KB doesn't contain S as a subsequence
4 Incorrect 149 ms 10504 KB doesn't contain S as a subsequence
5 Incorrect 137 ms 10380 KB doesn't contain S as a subsequence
6 Incorrect 147 ms 10464 KB doesn't contain S as a subsequence
7 Incorrect 136 ms 10588 KB doesn't contain S as a subsequence
8 Incorrect 171 ms 10572 KB doesn't contain S as a subsequence
9 Incorrect 130 ms 9556 KB doesn't contain S as a subsequence
10 Incorrect 120 ms 7628 KB doesn't contain S as a subsequence
11 Incorrect 109 ms 8348 KB doesn't contain S as a subsequence
12 Incorrect 97 ms 6380 KB doesn't contain S as a subsequence
13 Incorrect 83 ms 6444 KB doesn't contain S as a subsequence
14 Correct 82 ms 6456 KB Output is correct