codeforces Round #252 (Div. 2) C - Valera and Tubes
贪心算法,每条路径最短2格,故前k-1步每次走2格,最后一步全走完
由于数据比较小,可以先打表
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std; typedef pair<int,int> Point; int main(){
int n, m, k, flag = -;
cin >> n >> m >>k;
vector<Point> table;
for(int i = ; i < n ; ++i){
flag*=-;
for(int j = ; j < m; ++ j){
table.push_back(Point(i,flag> ? j : (m--j)));
}
}
for(int i = ; i <*(k -); i+=){
cout<<<<" "<<table[i].first+<<" "<<table[i].second+<<" "<<table[i+].first+<<" "<<table[i+].second+<<endl;
}
cout<<m*n-*(k-);
for(int i = *(k-); i < m*n; ++ i ){
cout<<" "<<table[i].first+<<" "<<table[i].second+;
}
cout<<endl;
}
关于额外的信息, |xi - xi + 1| + |yi - yi + 1| = 1,其实就是一个点的四连通区域,即上下左右4个点
codeforces Round #252 (Div. 2) C - Valera and Tubes的更多相关文章
- Codeforces Round #252 (Div. 2) B. Valera and Fruits(模拟)
B. Valera and Fruits time limit per test 1 second memory limit per test 256 megabytes input standard ...
- Codeforces Round #252 (Div. 2) B. Valera and Fruits
#include <iostream> #include <vector> #include <algorithm> #include <map> us ...
- Codeforces Round #252 (Div. 2) A - Valera and Antique Items
水题 #include <iostream> #include <set> #include <vector> #include <algorithm> ...
- Codeforces Round #252 (Div. 2) 441B. Valera and Fruits
英语不好就是坑啊.这道题把我坑残了啊.5次WA一次被HACK.第二题得分就比第一题高10分啊. 以后一定要加强英语的学习,要不然就跪了. 题意:有一个果园里有非常多树,上面有非常多果实,为了不然成熟的 ...
- Codeforces Round 252 (Div. 2)
layout: post title: Codeforces Round 252 (Div. 2) author: "luowentaoaa" catalog: true tags ...
- [Codeforces Round #237 (Div. 2)] A. Valera and X
A. Valera and X time limit per test 1 second memory limit per test 256 megabytes input standard inpu ...
- Codeforces Round #216 (Div. 2) D. Valera and Fools
题目链接:http://codeforces.com/contest/369/problem/D 注意题意:所有fools都向编号最小的fool开枪:但每个fool都不会笨到想自己开枪,所以编号最小的 ...
- Codeforces Round #252 (Div. 2) D
http://codeforces.com/problemset/problem/441/D 置换群的基本问题,一个轮换内交换成正常顺序需要k-1次,k为轮换内元素个数 两个轮换之间交换元素,可以把两 ...
- Codeforces Round #216 (Div. 2) B. Valera and Contest
#include <iostream> #include <algorithm> #include <vector> using namespace std; in ...
随机推荐
- php PDO:数据访问抽象层
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- (转)ORA-12519: TNS:no appropriate service handler found 的问题处理。
很多时候出现:ORA-12519: TNS:no appropriate service handler found 都是由于当前的连接数已经超出他能够处理的最大值了. 处理方法如下:摘自网上. se ...
- DHCP的若干原理解释
转自:http://blog.chinaunix.net/uid-22287947-id-1775641.html 搜罗了几种关于dhcp的原理和过程解释 DHCP(Dynamic Host Conf ...
- AOJ673 聪明的输入法(字典树)
#include<cstdio> #include <cstdlib> #include <cstring> #include <iostream> # ...
- Bat脚本实现MySQL数据库SQL文件备份
@echo offecho 在线兑奖系统自动备份脚本(请勿关闭) 联系人: 电话::loopset /a "FDate=%date:~,4%%date:~5,2%%date:~8,2%&q ...
- 在ASP.NET 5中如何方便的添加前端库
(此文章同时发表在本人微信公众号“dotNET每日精华文章”,欢迎右边二维码来关注.) 题记:ASP.NET 5和之前的ASP.NET版本有很大的不同,其中之一就是对前端库的管理不再使用Nuget,而 ...
- 用户层获取TEB PEB结构地址 遍历进程模块.doc
1.fs寄存器指向TEB结构 2.在TEB+0x30地方指向PEB结构 3.在PEB+0x0C地方指向PEB_LDR_DATA结构 4.在PEB_LDR_DATA+0x1C地方就是一些动态连接库地址了 ...
- js日期格式化
<html> <head> <script> function test(){ //Js获取当前日期时间及其它操作 var myDate = new Date(); ...
- 一定要学会paxos算法!
paxos算法 http://blog.csdn.net/dellme99/article/details/14162159
- 锤子banner
查看效果: http://js.jirengu.com/negor/4/edit?html,output <!DOCTYPE html> <html> <head> ...