先把一种最长路线记录下来,根据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(模拟)的更多相关文章

  1. Codeforces Round #249 (Div. 2) (模拟)

    C. Cardiogram time limit per test 1 second memory limit per test 256 megabytes input standard input ...

  2. 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 ...

  3. 题解——Codeforces Round #508 (Div. 2) T1 (模拟)

    依照题意暴力模拟即可A掉 #include <cstdio> #include <algorithm> #include <cstring> #include &l ...

  4. Codeforces Round #281 (Div. 2) B 模拟

    B. Vasya and Wrestling time limit per test 2 seconds memory limit per test 256 megabytes input stand ...

  5. Codeforces Round #281 (Div. 2) A 模拟

    A. Vasya and Football time limit per test 2 seconds memory limit per test 256 megabytes input standa ...

  6. Codeforces Round #362 (Div. 2) B 模拟

    B. Barnicle time limit per test 1 second memory limit per test 256 megabytes input standard input ou ...

  7. Codeforces Round #619 (Div. 2)E思维+二维RMQ

    题:https://codeforces.com/contest/1301/problem/E 题意:给个n*m的图形,q个询问,每次询问问询问区间最大的合法logo的面积是多少 分析:由于logo是 ...

  8. Codeforces Round #357 (Div. 2) 优先队列+模拟

    C. Heap Operations time limit per test 1 second memory limit per test 256 megabytes input standard i ...

  9. Codeforces Round #619 (Div. 2) A~D题解

    最近网课也开始了,牛客上一堆比赛题目也没补,所以就D题后面的也懒得补了 A.Three String 水题 #include <cstdio> #include <cstring&g ...

随机推荐

  1. HTML+PHP+MySQL 制作最基础的登录页面及验证

    第一步 进入mysql操作终端 新建一个数据库web1:create database web1; 然后在这个数据库里面新建一张表test:create table test(user varchar ...

  2. svn error: "Previous operation has not finished; run 'cleanup' if it was interrupted"

    出现这种问题,有几个原因 1.本身文件确实是锁住了 2.之前clean up 过很多次,但是每次都可能以失败告终,造成work queue存在缓存队列 3.svn lock 有lock记录 以下是简单 ...

  3. 统一操作系统 UOS 回应质疑 (独立思考)

    统一操作系统 UOS 回应质疑 自从统一操作系统UOS正式版面向合作伙伴发布之后,小编就关注到网上对统一操作系统UOS众说纷纭.留意了近期网友们发表的评论: “又多了一个骗钱的国产操作系统” “从UO ...

  4. win10系统中按顺序安装jdk、tomcat

    一.首先安装jdk1.8,重点在于配置环境 安装步骤见另一篇软件安装中的博客 配置环境 1.首先要打开系统环境变量配置的页面.具体操作是:桌面上找到“此电脑”,然后右键 “属性”. 然后打开高级系统配 ...

  5. 【Python】七段数码管绘制问题

    问题分析: 绘制路径: 代码: import turtle #引入绘图库turtle def drawLine(draw): #绘制单段数码管 turtle.pendown() if draw els ...

  6. Costco这样的超级零售商,能不能干掉电商?

    名创优品创始人叶国富曾说过,Costco只是没有来到中国(大陆),如果它来了,中国现在的零售业全部都会"死光".叶国富的话,似乎一语成箴. 随着Costco正式入华,其正在彻底搅动 ...

  7. MAT(memory anlayzer tool)使用方法

    Analyzing and understanding the memory use of an application is challenging. A subtle logic error ca ...

  8. 2级搭建类204-Oracle 12cR2 SI ASM 图形化搭建(RHEL7.6)

    红帽RHEL 7.6上搭建Oracle 12cR2 ASM单实例 我给你们说,不是自家的产品,那贼麻烦,你是不是觉得在 红帽 7.6 上搞 12c ASM 觉得应该/好像/可能/或许/貌似/大概/也许 ...

  9. weblogic的ssrf漏洞

    前言    什么是ssrf SSRF(Server-Side Request Forgery:服务器端请求伪造) 是一种由攻击者构造形成由服务端发起请求的一个安全漏洞. 一般情况下,SSRF攻击的目标 ...

  10. PWA - 整体(未完)

    渐进式 Web 应用(PWA) 运用现代的 Web API 以及传统的渐进式增强策略来创建跨平台 Web 应用程序. PWA 的优势 可被发现 易安装 manifest(https://develop ...