답안 #278193

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
278193 2020-08-21T11:13:45 Z test2 Zalmoxis (BOI18_zalmoxis) C++14
0 / 100
190 ms 16616 KB
#include<bits/stdc++.h>

#define I inline void 

using namespace std ; 

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

const int N = 2e6 + 7 ; 

// How interesting!

int n , k ; 
int a[N] ; 

int used = 0 ; 

vector<int> ans ; 

int dfs(int x , int val){
	if(a[x] > val){
		ans.push_back(val) ; 
		used ++ ; 
		assert(used < 2) ; 
		return x ; 
	}
	if(a[x] == val){	
		ans.push_back(val) ; 
		return x + 1 ; 
	}
	int ret1 = dfs(x , val - 1) ; 
	int ret2 = dfs(ret1 , val -1 ) ; 
	return ret2 ;  
}

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

	cin >> n >> k ; 
	a[n] = (1<<30) ;
	for(int i = 0 ;i < n ; i++){
		cin >> a[i] ; 
	}

	dfs(0 , 30 ) ; 

	vector<int> ans2 ; 

	for(auto u : ans){
		ans2.push_back(u) ; 
		/*while(used < k && ans2.back() > 1){
			int x = ans2.back() ; 
			ans2.pop_back() ; 
			ans2.push_back(x-1) ; 
			ans2.push_back(x-1) ; 
			used ++ ; 
		}*/
	}
	reverse(ans2.begin() , ans2.end()) ;
	for(auto u : ans2){
		cout<< u <<" " ; 
	}
	return 0 ; 
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 190 ms 14416 KB doesn't contain S as a subsequence
2 Incorrect 182 ms 14312 KB doesn't contain S as a subsequence
3 Incorrect 177 ms 14312 KB doesn't contain S as a subsequence
4 Incorrect 162 ms 14312 KB doesn't contain S as a subsequence
5 Incorrect 163 ms 14312 KB doesn't contain S as a subsequence
6 Incorrect 175 ms 14480 KB doesn't contain S as a subsequence
# 결과 실행 시간 메모리 Grader output
1 Runtime error 72 ms 8440 KB Execution killed with signal 11
2 Runtime error 71 ms 8440 KB Execution killed with signal 11
3 Runtime error 71 ms 8440 KB Execution killed with signal 11
4 Runtime error 73 ms 8440 KB Execution killed with signal 11
5 Runtime error 70 ms 8440 KB Execution killed with signal 11
6 Runtime error 70 ms 8440 KB Execution killed with signal 11
7 Runtime error 96 ms 16616 KB Execution killed with signal 11
8 Runtime error 74 ms 9464 KB Execution killed with signal 11
9 Runtime error 59 ms 6904 KB Execution killed with signal 11
10 Runtime error 22 ms 2940 KB Execution killed with signal 11
11 Runtime error 37 ms 4472 KB Execution killed with signal 11
12 Runtime error 1 ms 640 KB Execution killed with signal 11
13 Runtime error 2 ms 512 KB Execution killed with signal 11
14 Runtime error 2 ms 512 KB Execution killed with signal 11