Codeforces Round #620 (Div. 2)D(LIS,构造)
- #define HAVE_STRUCT_TIMESPEC
- #include<bits/stdc++.h>
- using namespace std;
- int ans[];
- int ans2[];
- int main(){
- ios::sync_with_stdio(false);
- cin.tie(NULL);
- cout.tie(NULL);
- int t;
- cin>>t;
- while(t--){
- int n;
- string s;
- cin>>n>>s;
- int mx=n;
- for(int i=;i<n;++i){
- int cnt=;
- while(i<n&&s[i]=='<'){
- ++cnt;
- ++i;
- }
- for(int j=i;j>i-cnt;--j){
- ans[j]=mx;//尽可能将大的数放在前面
- --mx;
- }
- }
- int mn=;
- for(int i=;i<n;++i){
- int cnt=;
- while(i<n&&s[i]=='>'){
- ++cnt;
- ++i;
- }
- for(int j=i;j>i-cnt;--j){
- ans2[j]=mn;//尽可能将小的数放在前面
- ++mn;
- }
- }
- for(int i=;i<n;++i)
- cout<<ans[i]<<" ";
- cout<<"\n";
- for(int i=;i<n;++i)
- cout<<ans2[i]<<" ";
- cout<<"\n";
- }
- return ;
- }
Codeforces Round #620 (Div. 2)D(LIS,构造)的更多相关文章
- Codeforces Round #620 (Div. 2)
Codeforces Round #620 (Div. 2) A. Two Rabbits 题意 两只兔子相向而跳,一只一次跳距离a,另一只一次跳距离b,每次同时跳,问是否可能到同一位置 题解 每次跳 ...
- Codeforces Round #620 (Div. 2)D dilworld定理
题:https://codeforces.com/contest/1304/problem/D 题意:给定长度为n-1的只含’>'和‘<’的字符串,让你构造出俩个排列,俩个排列相邻的数字之 ...
- Codeforces Round #277 (Div. 2) E. LIS of Sequence DP
E. LIS of Sequence Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/486/pr ...
- Codeforces Round #339 (Div. 1) C. Necklace 构造题
C. Necklace 题目连接: http://www.codeforces.com/contest/613/problem/C Description Ivan wants to make a n ...
- Codeforces Round #620 (Div. 2) D
构造一个排列,要求相邻之间的数满足给定的大小关系,然后构造出两个序列,一个序列是所有可能的序列中LIS最长的,一个所有可能的序列中LIS最短的 最短的构造方法:我们考虑所有单调递增的部分,可以发现要让 ...
- Codeforces Round #620 (Div. 2) A-F代码 (暂无记录题解)
A. Two Rabbits (手速题) #include<bits/stdc++.h> using namespace std; typedef long long ll; int ma ...
- Codeforces Round #620 (Div. 2)E LCA
题:https://codeforces.com/contest/1304/problem/E 题意:给定一颗树,边权为1,m次询问,每次询问给定x,y,a,b,k,问能否在原树上添加x到y的边,a到 ...
- Codeforces Round #181 (Div. 2) A. Array 构造
A. Array 题目连接: http://www.codeforces.com/contest/300/problem/A Description Vitaly has an array of n ...
- Codeforces Round #306 (Div. 2) ABCDE(构造)
A. Two Substrings 题意:给一个字符串,求是否含有不重叠的子串"AB"和"BA",长度1e5. 题解:看起来很简单,但是一直错,各种考虑不周全, ...
随机推荐
- gulp常用插件之gulp-inject使用
更多gulp常用插件使用请访问:gulp常用插件汇总 gulp-inject这个插件的作用与wiredep类似,不同的是可以自己任意指定需要插入文件的列表.它同样是利用注释来寻找插入的位置.获取源文件 ...
- 权限问题 <customErrors> 标记的“mode”属性设置为“Off”
引用 权限问题 <customErrors> 标记的“mode”属性设置为“Off”. 权限问题标记的“mode”属性设置为“Off”.说明: 服务器上出现应用程序错误.此应用程序的当前自 ...
- react-父子子孙组件嵌套-context
方案一 import React from 'react' import ReactTypes from 'prop-types' /* // 最外层的父组件 export default class ...
- OpenCV3.2.0+VS2015开发环境配置
vs2015安装可参考:https://www.jianshu.com/p/391e67529bd3 OpenCV3.2.0配置可参考:https://www.jianshu.com/p/026093 ...
- Java 中多态的实现(下)
Java 中多态的另一个语法实现是重写.重载是通过静态分派实现的,重写则是通过动态分派实现的. 在学习动态分派之前,需要对虚拟机的知识有一个初步的了解. 虚拟机运行时数据区 运行 Java 程序时,虚 ...
- 0002 Django工程创建
1 创建一个目录,用于专门存放Django工程的虚拟环境 PyCharm默认虚拟环境在工程内,从而导致打包的时候,会把虚拟环境一起打包. 同时,虚拟环境中的插件较多,一个工程创建了一个虚拟环境,以后, ...
- SQLyog怎么导入mysql数据库
参考链接:https://jingyan.baidu.com/article/647f0115c5ad9f7f2148a8c6.html
- Oracle库基本操作
--oracle 获取表名称,字段 with vA as ( SELECT USER_TAB_COLS.TABLE_NAME as 表名,USER_TAB_COLS.COLUMN_NAME as 列名 ...
- 常见通用框架的理解(Redis,Zookeeper,Thrift)
redis 主要功能是内存版的Hashta zookeeper 主要功能是分布式中的全局变量. thrift 跨平台的Client和Server通信架构. taskengine用于启动定时任务和查看 ...
- nodemon:无法将“nodemon”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。
主要问题还是你的终端(也就是你的nodemon命令执行的地方没有这个环境) 解决方法:设置全局的nodemon,在终端执行 npm install -g nodemon