贪心算法,每条路径最短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的更多相关文章

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

  2. Codeforces Round #252 (Div. 2) B. Valera and Fruits

    #include <iostream> #include <vector> #include <algorithm> #include <map> us ...

  3. Codeforces Round #252 (Div. 2) A - Valera and Antique Items

    水题 #include <iostream> #include <set> #include <vector> #include <algorithm> ...

  4. Codeforces Round #252 (Div. 2) 441B. Valera and Fruits

    英语不好就是坑啊.这道题把我坑残了啊.5次WA一次被HACK.第二题得分就比第一题高10分啊. 以后一定要加强英语的学习,要不然就跪了. 题意:有一个果园里有非常多树,上面有非常多果实,为了不然成熟的 ...

  5. Codeforces Round 252 (Div. 2)

    layout: post title: Codeforces Round 252 (Div. 2) author: "luowentaoaa" catalog: true tags ...

  6. [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 ...

  7. Codeforces Round #216 (Div. 2) D. Valera and Fools

    题目链接:http://codeforces.com/contest/369/problem/D 注意题意:所有fools都向编号最小的fool开枪:但每个fool都不会笨到想自己开枪,所以编号最小的 ...

  8. Codeforces Round #252 (Div. 2) D

    http://codeforces.com/problemset/problem/441/D 置换群的基本问题,一个轮换内交换成正常顺序需要k-1次,k为轮换内元素个数 两个轮换之间交换元素,可以把两 ...

  9. Codeforces Round #216 (Div. 2) B. Valera and Contest

    #include <iostream> #include <algorithm> #include <vector> using namespace std; in ...

随机推荐

  1. MVC基础知识 – 2.新语法

    1.自动属性 Auto-Implemented Properties 2.隐式类型 var 3.参数默认值 和 命名参数 4.对象初始化器 与 集合初始化器 { } 5.匿名类 & 匿名方法 ...

  2. SQL——触发器——插入触发器——边学边项目写的。

    需求: 项目表项目编码触发器编写 为项目表DwProject编写触发器,目的为当创建新项目时,且ProjectNo 为Null或空字符串时,自动创建项目编号,编号格式为4位年号,2位月份,2位顺序号, ...

  3. HTML5学习之智能表单(二)

    <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <m ...

  4. Metrics介绍

    Metrics可以为你的代码的运行提供无与伦比的洞察力.作为一款监控指标的度量类库,它提供了很多模块可以为第三方库或者应用提供辅助统计信息, 比如Jetty, Logback, Log4j, Apac ...

  5. sublime text 全局搜索

    Ctrl+Shift+F Mac下是commadn+Shift+F 在下面Find中填入需要搜索的关键字 点击find

  6. NS2中修改载波侦听范围和传输范围

    修改这两个值是在tcl中进行的,加上 Phy/WirelessPhy set CSThresh_ 1.559e-11 ;#550m Phy/WirelessPhy set RXThresh_ 3.65 ...

  7. IOS登陆+注册+抽奖+排行榜

    要求:三个页面(登录页面,pickerView页面,排行榜页面),pickerView页面是三个组件,每个组件显示0-9,点击按钮进行随机,获得的值存入排行榜,排行榜显示大于500的最高的10个分数和 ...

  8. JavaScript中call,apply和prototype

    [TOC] call()方法 语法:call([thisObj[,arg1[, arg2[, [,.argN]]]]]) 定义:调用一个对象的一个方法,以另一个对象替换当前对象. 如果没有提供 thi ...

  9. HTML Entity Sets - All

    http://www.htmlentities.com/html/entities/ The view below displays the characters used in the offici ...

  10. 编译原理实习(应用预测分析法LL(1)实现语法分析)

    #include<iostream> #include<fstream> #include<iomanip> #include<cstdio> #inc ...