Submission #278082

# Submission time Handle Problem Language Result Execution time Memory
278082 2020-08-21T09:54:39 Z test2 Zalmoxis (BOI18_zalmoxis) C++14
0 / 100
119 ms 11388 KB
#include<bits/stdc++.h>

#define I inline void 

using namespace std ; 

using ll = long long ; 
using ld = long double ; 

const int N = 1e5 + 7 ; 

// How interesting!

int n , k ; 

int main(){
	ios_base::sync_with_stdio(0) ; 
	cin.tie(0) ; 
	//freopen("in.in", "r" , stdin) ;

	cin >> n >> k ; 

	vector< int > v ; 
	deque<int> dq ;

	int mn = 2e9 ; 
	int j ; 
	for(int i = 0 ;i < n ;i++){
		int x ; 
		cin >> x ; 
		v.push_back(x) ; 
		if(x < mn){
			mn = x ; 
			j = i ; 
		}		
	}

	dq.push_back(mn) ; 
	int l = j , r = j; 
	int ver = mn ; 
	while(l || r < n - 1 || k ){
		if(l && v[l-1] == ver){
			ver++ ;
			dq.push_front(v[l-1]) ;  
			l-- ; 
		}
		else if(r < n - 1 && v[r+1] == ver){
			ver++ ; 
			dq.push_back(v[r+1]) ; 
			r++; 
		}else if(k){
			dq.push_back(ver) ; 
			ver++ ; 
			k-- ; 
		}
		else break ; 		
	}
	while(dq.size()){
		cout<< dq.front() <<" " ; 
		dq.pop_front() ; 
	}
	return 0 ; 
}

Compilation message

zalmoxis.cpp: In function 'int main()':
zalmoxis.cpp:42:14: warning: 'j' may be used uninitialized in this function [-Wmaybe-uninitialized]
   42 |   if(l && v[l-1] == ver){
      |             ~^~
# Verdict Execution time Memory Grader output
1 Incorrect 68 ms 4588 KB Unexpected end of file - int32 expected
2 Incorrect 68 ms 4588 KB Unexpected end of file - int32 expected
3 Incorrect 68 ms 4588 KB Unexpected end of file - int32 expected
4 Incorrect 68 ms 4588 KB Unexpected end of file - int32 expected
5 Incorrect 68 ms 4596 KB Unexpected end of file - int32 expected
6 Incorrect 70 ms 4584 KB Unexpected end of file - int32 expected
# Verdict Execution time Memory Grader output
1 Incorrect 71 ms 4744 KB Unexpected end of file - int32 expected
2 Incorrect 68 ms 4588 KB Unexpected end of file - int32 expected
3 Incorrect 68 ms 4592 KB Unexpected end of file - int32 expected
4 Incorrect 68 ms 4588 KB Unexpected end of file - int32 expected
5 Incorrect 70 ms 4584 KB Unexpected end of file - int32 expected
6 Incorrect 67 ms 4588 KB Unexpected end of file - int32 expected
7 Incorrect 67 ms 4588 KB Unexpected end of file - int32 expected
8 Incorrect 68 ms 4588 KB Unexpected end of file - int32 expected
9 Incorrect 73 ms 5600 KB Unexpected end of file - int32 expected
10 Incorrect 95 ms 9192 KB Unexpected end of file - int32 expected
11 Incorrect 82 ms 7784 KB Unexpected end of file - int32 expected
12 Incorrect 119 ms 11384 KB Unexpected end of file - int32 expected
13 Incorrect 100 ms 11384 KB Unexpected end of file - int32 expected
14 Incorrect 113 ms 11388 KB not a zalsequence