#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <stack>
#include <vector>
using namespace std;
#define LL long long
const int N = ;
vector<LL> arr;
bool vis[N];
void solve()
{
while (true)
{
fill(vis, vis + arr.size(), );
bool f = true;
for (int i = ; i < arr.size(); i++)
{
if (i > && arr[i] < arr[i - ])
{
vis[i - ] = vis[i] = ;
f = false;
}
if (i < arr.size() - && arr[i] > arr[i + ])
{
vis[i + ] = vis[i] = ;
f = false;
}
}
if (f)break;
for (int i = arr.size() - ; i >= ; i--)
{
if (vis[i])arr.erase(arr.begin() + i);
}
}
}
int main()
{
freopen("in.txt", "r", stdin);
freopen("outstd.txt", "w", stdout);
cin.sync_with_stdio(false);
LL t, n;
cin >> t;
while (t--)
{
int id;
cin >> id;
cout << id<<':' << endl;
cin >> n;
arr.clear();
for (int i = ; i < n; i++)
{
LL num;
cin >> num;
arr.push_back(num);
}
solve();
cout << arr.size() << endl;
for (int i = ; i < arr.size(); i++)
cout << arr[i] << ' ';
cout << endl; } }

最新文章

  1. (转载)详解网络传输中的三张表,MAC地址表、ARP缓存表以及路由表
  2. laravel 控制器里 redirect url地址传两个参数的方法
  3. 从零开始写一个武侠冒险游戏-6-用GPU提升性能(1)
  4. Codeforces Round #303 (Div. 2) A 水
  5. JS下高效拼装字符串的几种方法比较与测试代码
  6. Activity学习(一)——状态转变
  7. 自定义视图控制器切换(iOS)
  8. OC之KVC,KVO
  9. Codeforces 766D. Mahmoud and a Dictionary 并查集 二元敌对关系 点拆分
  10. jQuery EasyUI布局容器layout实例精讲
  11. Confluence 6 安全相关问题提交链接
  12. java常用类-StringBuffer,Integer,Character
  13. 论Injection的前世今生
  14. Leetcode 题解 Longest Substring Without Repeating Characters_需要重做
  15. ibatis.net之我的调整:Update语句的动态set字段
  16. 未定义变量 &quot;caffe&quot; 或类 &quot;caffe.reset_all&quot;
  17. MVC---- DataSet 页面遍历
  18. docker-compose 部署 EFK
  19. struts2配置默认首页
  20. 轻量ORM-SqlRepoEx (十四)最佳实践之Dapper(1)

热门文章

  1. Mininet系列实验(一):Mininet使用源码安装
  2. Vue学习手记03-路由跳转与路由嵌套
  3. Python日志库logging总结-可能是目前为止将logging库总结的最好的一篇文章
  4. SpringBoot+Mybatis+Maven+MySql小案例
  5. Jupyter Notebook 远程连接配置(转载)
  6. Linux下通过shell进MySQL执行SQL或导入脚本
  7. Java测试当前应用所占用的内存示例
  8. application.properties在Spring Boot项目中的位置
  9. c#操作json数据使用newtonsoft.json
  10. SQL Server 2008 R2如何使用正则表达式搜索