Submission #98498

# Submission time Handle Problem Language Result Execution time Memory
98498 2019-02-23T19:09:25 Z thiago4532 Kronican (COCI16_kronican) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
// #define int int64_t
#define int uint_fast32_t

using namespace std;
const int maxn = 1010;
int v[maxn], i;
deque<int> dq;
int ct=0, n;

void backtracking(int i, deque<int> const& d){
	if(i == n){
		if(d == dq) ct++;
		return;
	}

	deque<int> d1 = d, d2 = d;
	d1.push_back(v[i]);
	d2.push_front(v[i]);
	backtracking(i+1, d1);
	backtracking(i+1, d2);
}

int lis(){
	
	vector<int> pilha;
	
	for(int i=0; i<n; i++){
		vector<int>::iterator it = lower_bound(pilha.begin(), pilha.end(), v[i]);
		if(it==pilha.end()) pilha.push_back(v[i]);
		else *it = v[i];
	}
	
	return pilha.size();
}

int32_t main(){
	cin >> n;

	int aux;
	cin >> aux;
	dq.push_back(aux);

	for(int i=2;i<=n;i++){
		int x;
		cin >> x;
		if(x <= dq[0]) dq.push_front(x);
		else dq.push_back(x);
	}
	for(int i=0;i<n;i++)
		v[i] = dq[i], cout << dq[i] << " \n"[i==n-1];

	backtracking(1, deque<int>({v[0]}));
	
	cout << lis
	//cout << "Count: " << ct << "\n";
	return 0;
}

Compilation message

kronican.cpp: In function 'int32_t main()':
kronican.cpp:55:10: warning: the address of 'uint_fast32_t lis()' will never be NULL [-Waddress]
  cout << lis
          ^~~
kronican.cpp:57:2: error: expected ';' before 'return'
  return 0;
  ^~~~~~