답안 #579792

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
579792 2022-06-19T21:22:24 Z AlperenT Zalmoxis (BOI18_zalmoxis) C++17
0 / 100
177 ms 12604 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){
			lft.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){
      |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 130 ms 12476 KB doesn't contain S as a subsequence
2 Incorrect 177 ms 12604 KB doesn't contain S as a subsequence
3 Incorrect 147 ms 12504 KB doesn't contain S as a subsequence
4 Incorrect 170 ms 12500 KB doesn't contain S as a subsequence
5 Incorrect 141 ms 12476 KB doesn't contain S as a subsequence
6 Incorrect 132 ms 12504 KB doesn't contain S as a subsequence
# 결과 실행 시간 메모리 Grader output
1 Incorrect 134 ms 12468 KB doesn't contain S as a subsequence
2 Incorrect 140 ms 12456 KB doesn't contain S as a subsequence
3 Incorrect 138 ms 12504 KB doesn't contain S as a subsequence
4 Incorrect 143 ms 12488 KB doesn't contain S as a subsequence
5 Incorrect 140 ms 12472 KB doesn't contain S as a subsequence
6 Incorrect 137 ms 12448 KB doesn't contain S as a subsequence
7 Incorrect 146 ms 12600 KB doesn't contain S as a subsequence
8 Incorrect 144 ms 12460 KB doesn't contain S as a subsequence
9 Incorrect 122 ms 11308 KB doesn't contain S as a subsequence
10 Incorrect 106 ms 8180 KB doesn't contain S as a subsequence
11 Incorrect 112 ms 9360 KB doesn't contain S as a subsequence
12 Incorrect 83 ms 6356 KB doesn't contain S as a subsequence
13 Incorrect 81 ms 6328 KB doesn't contain S as a subsequence
14 Incorrect 95 ms 6364 KB not a zalsequence