CSES - KILO 2017 2/5 - Results
Submission details
Task:LCS
Sender:rip
Submission time:2017-09-12 17:10:27 +0300
Language:C++
Status:COMPILE ERROR

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:19:2: error: 'sync_with_std' is not a member of 'std::ios {aka std::basic_ios<char>}'
  ios::sync_with_std(0); cin.tie(0);
  ^

Code

#include <bits/stdc++.h>

using namespace std;
#define H (1<<10)
int t[2*H];

int asd(int a, int b){
	a+=H, b+=H;
	int V = 0;
	while(a<=b){
		if(a%2==1) V = max(V, t[a++]);
		if(b%2==0) V = max(V, t[b--]);
		a/=2, b/=2;
	}
	return V;
}

int main(){
	ios::sync_with_std(0); cin.tie(0);
	string n, m;
	cin >> n >> m;
	int N = n.size(), M = m.size();
	for(int i=0; i<N; ++i){
		for(int j=0; j<M; ++j){
			if(m[i] == n[j]) t[j+H] = max(t[j+H], asd(0, j-1)+1);
			int k = j+H;
			for(k/=2; k>=1; k/=2) t[k] = max(t[2*k], t[2*k+1]);
		}
	}
	cout << asd(0, M);
}