Codeforces Round #619 (Div. 2)D(模拟)
先把一种最长路线记录下来,根据k的大小存到ans中相应的答案再输出
- #define HAVE_STRUCT_TIMESPEC
- #include<bits/stdc++.h>
- using namespace std;
- vector<char>vv;
- vector<pair<int,char>>ans;
- int main(){
- ios::sync_with_stdio(false);
- cin.tie(NULL);
- cout.tie(NULL);
- int n,m,k;
- cin>>n>>m>>k;
- int mx=*m*n-*m-*n;
- if(k>mx){
- cout<<"NO\n";
- return ;
- }
- for(int i=;i<n;++i)
- vv.emplace_back('D');
- for(int i=;i<m;++i)
- vv.emplace_back('R');
- for(int j=m;j>;--j){
- for(int i=n;i>;--i)
- vv.emplace_back('U');
- for(int i=;i<n;++i)
- vv.emplace_back('D');
- vv.emplace_back('L');
- }
- for(int i=n-;i>=;--i){
- vv.emplace_back('U');
- for(int j=;j<m;++j)
- vv.emplace_back('R');
- for(int j=m;j>;--j)
- vv.emplace_back('L');
- }
- char pos=vv[];
- int cnt=;
- for(int i=;i<k;++i)
- if(pos==vv[i])
- ++cnt;
- else{
- ans.push_back({cnt,pos});
- pos=vv[i];
- cnt=;
- }
- if(cnt)
- ans.push_back({cnt,pos});
- cout<<"YES\n";
- cout<<ans.size()<<"\n";
- for(auto it:ans)
- cout<<it.first<<" "<<it.second<<"\n";
- return ;
- }
Codeforces Round #619 (Div. 2)D(模拟)的更多相关文章
- Codeforces Round #249 (Div. 2) (模拟)
C. Cardiogram time limit per test 1 second memory limit per test 256 megabytes input standard input ...
- Codeforces Round #366 (Div. 2) C 模拟queue
C. Thor time limit per test 2 seconds memory limit per test 256 megabytes input standard input outpu ...
- 题解——Codeforces Round #508 (Div. 2) T1 (模拟)
依照题意暴力模拟即可A掉 #include <cstdio> #include <algorithm> #include <cstring> #include &l ...
- Codeforces Round #281 (Div. 2) B 模拟
B. Vasya and Wrestling time limit per test 2 seconds memory limit per test 256 megabytes input stand ...
- Codeforces Round #281 (Div. 2) A 模拟
A. Vasya and Football time limit per test 2 seconds memory limit per test 256 megabytes input standa ...
- Codeforces Round #362 (Div. 2) B 模拟
B. Barnicle time limit per test 1 second memory limit per test 256 megabytes input standard input ou ...
- Codeforces Round #619 (Div. 2)E思维+二维RMQ
题:https://codeforces.com/contest/1301/problem/E 题意:给个n*m的图形,q个询问,每次询问问询问区间最大的合法logo的面积是多少 分析:由于logo是 ...
- Codeforces Round #357 (Div. 2) 优先队列+模拟
C. Heap Operations time limit per test 1 second memory limit per test 256 megabytes input standard i ...
- Codeforces Round #619 (Div. 2) A~D题解
最近网课也开始了,牛客上一堆比赛题目也没补,所以就D题后面的也懒得补了 A.Three String 水题 #include <cstdio> #include <cstring&g ...
随机推荐
- StyleLint 使用指南
StyleLint 是『一个强大的.现代化的 CSS 检测工具』, 与 ESLint 类似, 是通过定义一系列的编码风格规则帮助我们避免在样式表中出现错误. 安装stylelint npm insta ...
- UVA10085-不知错在何处
#include<cstdio> #include<cstring> #include<iostream> #include<algorithm> #i ...
- 关于MySQL数据库中null的那些事
在mysql数据库中,null是一个经常出现的情况,关于mysql中的null,有哪些注意事项呢?下面简单总结归纳下,后续会不断补充. 1. is null 首先判断数据库中某一列的值是否为null, ...
- PIE-SDK For C++内存栅格数据的创建
1.功能简介 目前在地理信息领域中数据包括矢量和栅格两种数据组织形式.每一种数据有不同的数据格式,目前PIE SDK支持多种数据格式的数据创建,下面对内存栅格数据格式的数据创建功能进行介绍. 2.功能 ...
- 线段树(lazy标记)-- 模板
], lazy[MAXN << ]; void PushUp(int rt) { ans[rt] = ans[rt << ] + ans[rt << | ]; } ...
- Python 高维数组“稀疏矩阵”scipy sparse学习笔记
scipy 里面的sparse函数进行的矩阵存储 可以节省内存 主要是scipy包里面的 sparse 这里目前只用到两个 稀疏矩阵的读取 sparse.load() 转稀疏矩阵为普通矩阵 spars ...
- gulp-css-spriter 雪碧图合并
相信做前端的同学都做过这样的事情,为优化图片,减少请求会把拿到切好的图标图片,通过ps(或者其他工具)把图片合并到一张图里面,再通过css定位把对于的样式写出来引用的html里面.gulp-css-s ...
- 缓存 - 数据缓存 - IndexedDB - Dexie.js
Classes Dexie DexieError Collection and():Add JS based criteria to collection(向集合添加基于JS的条件) delete() ...
- java中拦截器与过滤器
注:文摘自网络,仅供自己参考 1.首先要明确什么是拦截器.什么是过滤器 1.1 什么是拦截器: 拦截器,在AOP(Aspect-Oriented Programming)中用于在某个方法或字段被访问之 ...
- 简单scrapy爬虫实例
简单scrapy爬虫实例 流程分析 抓取内容:网站课程 页面:https://edu.hellobi.com 数据:课程名.课程链接及学习人数 观察页面url变化规律以及页面源代码帮助我们获取所有数据 ...