Submission #278081

# Submission time Handle Problem Language Result Execution time Memory
278081 2020-08-21T09:52:05 Z test2 Zalmoxis (BOI18_zalmoxis) C++14
0 / 100
117 ms 11384 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 = 1e9 ; 
	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 73 ms 4844 KB Unexpected end of file - int32 expected
2 Incorrect 79 ms 4716 KB Unexpected end of file - int32 expected
3 Incorrect 74 ms 4716 KB Unexpected end of file - int32 expected
4 Incorrect 74 ms 4716 KB Unexpected end of file - int32 expected
5 Incorrect 68 ms 4716 KB Unexpected end of file - int32 expected
6 Incorrect 68 ms 4716 KB Unexpected end of file - int32 expected
# Verdict Execution time Memory Grader output
1 Incorrect 70 ms 4712 KB Unexpected end of file - int32 expected
2 Incorrect 68 ms 4720 KB Unexpected end of file - int32 expected
3 Incorrect 68 ms 4720 KB Unexpected end of file - int32 expected
4 Incorrect 68 ms 4716 KB Unexpected end of file - int32 expected
5 Incorrect 69 ms 4712 KB Unexpected end of file - int32 expected
6 Incorrect 69 ms 4792 KB Unexpected end of file - int32 expected
7 Incorrect 75 ms 4716 KB Unexpected end of file - int32 expected
8 Incorrect 97 ms 4712 KB Unexpected end of file - int32 expected
9 Incorrect 78 ms 5860 KB Unexpected end of file - int32 expected
10 Incorrect 92 ms 9292 KB Unexpected end of file - int32 expected
11 Incorrect 87 ms 7912 KB Unexpected end of file - int32 expected
12 Incorrect 95 ms 11384 KB Unexpected end of file - int32 expected
13 Incorrect 117 ms 11384 KB Unexpected end of file - int32 expected
14 Incorrect 100 ms 11384 KB not a zalsequence