榄疖舠亻

#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;

int lis[N], a[N], n, ans1, ans2 = 1, iii;

/*
	bool check()
	{
		for (int i = 1; i <= n; i++)
			if (a[i])
				return false;
		return true;
	}
	
	void clean()
	{
		for (int i = 1; i <= n; i++)
			for (int j = 1; j <= n; j++)
				if (lis[i] == a[j])
				{
					lis[i] = a[j] = 0;
					break;
				}
	}
}
*/

void ppp()
{
	for (int i = 0; i <= 15; i++)
		cout << lis[i] << " ";
	cout << endl;
}

int a2()
{
	int l = 1;
	for (int i = 1; i <= n; i++)
	{
		int ptr = lower_bound(lis, lis + l, a[i]) - lis;
		lis[ptr] = a[i];
		if (ptr == l)
			l++;
	}
	return l;
}

int main()
{
	while (cin >> a[n++]) {/*empty*/}
	for (int i = 0; i < n / 2; i++)
		swap(a[n - i - 1], a[i]);
//	ppp();
	ans1 = a1();
	ans2 = a2();
	cout << ans1 - 1 << " " << ans2;
	
	return 0;
}

傌陬氜

#include <bits/stdc++.h>
using namespace std;
const int N = 20 + 10;

struct sit
{
	int x, y;
};

int n, m, sx, sy, ans, k;
char c;
bool a[N][N];
const int dx[8] = {-2, -2, -1, -1, 1, 1, 2, 2}; 
const int dy[8] = {-1, 1, 2, -2, -2, 2, -1, 1};

bool check()
{
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= n; j++)
			if (a[i][j])
				return false;
	return true;
}

void bfs(int sx, int sy)
{
	queue <sit> q;
	q.push( {sx, sy} );
	a[sx][sy] = false;
	ans++;
	
	while (q.size())
	{
		if (check())
			ans++;
		sit top = q.front();
		q.pop();
		a[top.x][top.y] = false;
//		cout << top.x << " " << top.y << endl;
		for (int i = 0; i < 8; i++)
		{
			int xx = top.x + dx[i];
			int yy = top.y + dy[i];
			if (xx >= 1 and xx <= n and yy >= 1 and yy <= m and a[xx][yy])
			{
				q.push( {xx, yy} );
				a[xx][yy] = false;
			}
		}
	}
}

int main()
{
	cin >> k;
	while (k--)
	{
		cin >> n >> m >> sx >> sy;
		memset(a, true, sizeof(a));
		bfs(sx, sy);
		cout << 0 << endl;
		ans = 0;
	}
	
	return 0;
}

溜开蚊撒嘛!!

#include<iostream>
#include<algorithm>
using namespace std;
int n;
int a[114514];//序列 
int rf[114514];//每一个的最长上升子序列的长度 
int ma;
int cnt;
int sum;
int idx;
int main(){
	while(cin>>n) a[++cnt]=n;
	n=cnt;
//	idx=n;
//	cnt=0;
	fill(rf,rf+n+1,1);//考虑最差情况,每一个也至少是1 
	for(int i=2;i<=n;i++){
		for(int j=1;j<i;j++){
			if(a[j]>=a[i]){
				rf[i]=max(rf[j]+1,rf[i]);
			}
		}
		ma=max(rf[i],ma);
	}
	cout<<ma<<endl;
//	sort(rf+1,rf+n+1);
//	while(sum<n){
//		sum+=rf[idx];
//		idx--;
//		cnt++;
//	}
	ma=0;
	fill(rf,rf+n+1,1);//考虑最差情况,每一个也至少是1 
	for(int i=2;i<=n;i++){
		for(int j=1;j<i;j++){
			if(a[j]<a[i]){
				rf[i]=max(rf[j]+1,rf[i]);
			}
		}
		ma=max(rf[i],ma);
	}
	cout<<ma;
	return 0;
}
//90 103 99 83 102 70 86 70 99 71
//5 3
//89 126 85 103 101 86 86 98 96 99 89 81 101 92 79 77 82 97 83 100 78 72 79 97 71 80 98 89 69 74
//12 6