답안 #278073

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
278073 2020-08-21T09:46:47 Z test2 Zalmoxis (BOI18_zalmoxis) C++14
0 / 100
104 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 ; 
	v.push_back(0) ;
	for(int i = 1 ;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){
		if(l && v[l-1] == ver){
			ver++ ;
			dq.push_front(v[l-1]) ;  
			l-- ; 
		}
		else if(r<= n && 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:43:14: warning: 'j' may be used uninitialized in this function [-Wmaybe-uninitialized]
   43 |   if(l && v[l-1] == ver){
      |             ~^~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 69 ms 4716 KB Unexpected end of file - int32 expected
2 Incorrect 68 ms 4716 KB Unexpected end of file - int32 expected
3 Incorrect 72 ms 4712 KB Unexpected end of file - int32 expected
4 Incorrect 69 ms 4740 KB Unexpected end of file - int32 expected
5 Incorrect 70 ms 4712 KB Unexpected end of file - int32 expected
6 Incorrect 72 ms 4716 KB Unexpected end of file - int32 expected
# 결과 실행 시간 메모리 Grader output
1 Incorrect 68 ms 4720 KB Unexpected end of file - int32 expected
2 Incorrect 88 ms 4716 KB Unexpected end of file - int32 expected
3 Incorrect 71 ms 4716 KB Unexpected end of file - int32 expected
4 Incorrect 69 ms 4716 KB Unexpected end of file - int32 expected
5 Incorrect 72 ms 4716 KB Unexpected end of file - int32 expected
6 Incorrect 68 ms 4712 KB Unexpected end of file - int32 expected
7 Incorrect 104 ms 4712 KB Unexpected end of file - int32 expected
8 Incorrect 73 ms 4716 KB Unexpected end of file - int32 expected
9 Incorrect 92 ms 5728 KB Unexpected end of file - int32 expected
10 Incorrect 92 ms 9192 KB Unexpected end of file - int32 expected
11 Incorrect 82 ms 7784 KB Unexpected end of file - int32 expected
12 Incorrect 98 ms 11384 KB Unexpected end of file - int32 expected
13 Incorrect 102 ms 11384 KB Unexpected end of file - int32 expected
14 Incorrect 96 ms 11384 KB not a zalsequence