2013-09-18 08:13

//By BLADEVIL
var
n, m :longint;
pre, other :array[..] of longint;
last :array[..] of longint;
flag :array[..] of boolean;
tot :longint;
ans :array[..] of longint;
i :longint;
l :longint; procedure connect(x,y:longint);
begin
inc(l);
pre[l]:=last[x];
last[x]:=l;
other[l]:=y;
end; procedure init;
var
i :longint;
x, y :longint;
begin
read(n,m);
for i:= to m do
begin
read(x,y);
connect(x,y);
connect(y,x);
end;
end; procedure dfs(x:longint);
var
p, q :longint;
begin
q:=last[x];
while q<> do
begin
p:=other[q];
if not flag[q] then
begin
flag[q]:=true;
dfs(p);
end;
q:=pre[q];
end;
inc(tot);
ans[tot]:=x;
end; begin
assign(input,'watch.in'); reset(input);
assign(output,'watch.out'); rewrite(output);
init;
dfs();
for i:=tot downto do writeln(ans[i]);
close(input); close(output);
end.

usaco 月赛 2005 january watchcow的更多相关文章

  1. usaco 月赛 2005 january sumset

    2013-09-18 08:23 打表找规律 w[i]:=w[i-1];  奇 w[i]:=w[i-1]+w[i div 2];     偶 //By BLADEVIL var w :..] of l ...

  2. USACO月赛2005 january volume

    2013-09-18 08:12 由题可知,ans=∑i  ∑j(x[i]-x[j]) 最后整理完之后应该是不同系数的X[i]相加,所以这道题就成了求不同x[i]的系数 对于X[i],它需要减前面(i ...

  3. USACO月赛数据

    终于找到了usaco月赛的数据…… 根据月赛的名称,我们可以写出数据地址.比如08年一月的月赛即是:http://contest.usaco.org/JAN08  这里要注意区分大小写.

  4. POJ 2230 Watchcow && USACO Watchcow 2005 January Silver (欧拉回路)

    Description Bessie's been appointed the new watch-cow for the farm. Every night, it's her job to wal ...

  5. USACO 2005 January Gold The Wedding Juicer

    题目 题目链接,我只在poj上找到了题目,usaco居然上不去. 大意就是说有一些\(1\times 1\times 1\)的小方块堆在一起,问最多能装多少水. 我们在一次测试中出了这题,由于我写水题 ...

  6. usaco月赛,2017.1总结

    T1:跳舞的奶牛 大致题意:一个体积为k的舞台能够同时容纳k只奶牛一起跳舞,他们每头奶牛的跳舞时间不同,如果有一只奶牛跳完了第k+1头奶牛就会立刻上场跳舞,当所有奶牛跳完舞以后我们认为这次表演结束.现 ...

  7. [题解]某模拟题(USACO月赛部分题+noip2005部分题)

    题目描述 农场上有N(1 <= N <= 50,000)堆草,放在不同的地点上.FJ有一辆拖拉机,也在农场上.拖拉机和草堆都表示为二维平面上的整数坐标,坐标值在1..1000的范围内.拖拉 ...

  8. Telephone Lines USACO 月赛

    以前做过这套题目 这个题又重新写了:http://www.cnblogs.com/jh818012/archive/2013/05/05/3182681.html 还是以前的思路 一直错在一个地方:决 ...

  9. bzoj 1600 &amp; Usaco 月赛 2008 建造栅栏 题解

    [原题] 1600: [Usaco2008 Oct]建造栅栏 Time Limit: 5 Sec  Memory Limit: 64 MB Submit: 785  Solved: 443 [Subm ...

随机推荐

  1. iOS下原生与JS交互(总结)

    iOS开发免不了要与UIWebView打交道,然后就要涉及到JS与原生OC交互,今天总结一下JS与原生OC交互的两种方式. JS调用原生OC篇(我自己用的方式二,简单方便) 方式一 第一种方式是用JS ...

  2. Anytime项目开发记录4

    做事情列表,我在程序中命名为“正在做”. 这是一个Fragment,应用的主页面,由一个MainActivity加上DoingListFragment和PersonFragment组成.PersonF ...

  3. 问题 A: Least Common Multiple

    题目描述 The least common multiple (LCM) of a set of positive integers is the smallest positive integer ...

  4. Cassandra - Insert after Delete fails silently

    在delete一条数据后,再insert 相同内容的数据,结果看起来是成功的,但是当你去查找这个数据,却没有任何内容,整个过程并且没有任何异常提示. 这往往发生在单元测试的时候,我们反复清理和写入数据 ...

  5. skip-grant-tables 修改linux的mysql忘记root密码

    skip-grant-tables 修改linux的mysql忘记root密码 今天修改mysql中的admin用户权限,在执行update user set host =' %' where use ...

  6. JSONP跨域jQuery处理整理(附天气数据实例)

    写在前面 跨域的解决方案有多种,其中最常见的是使用同一服务器下的代理来获取远端数据,再通过ajax进行读取,而在这期间经过了两次请求过程,使得获取数据的效率大大降低,这篇文章蓝飞就为大家介绍一下解决跨 ...

  7. 使用PNotify构建消息弹窗

    参考地址 官网:http://sciactive.com/pnotify/ GitHub:https://github.com/sciactive/pnotify npm仓库:https://www. ...

  8. 揭开网络编程常见API的面纱【上】

    Linux网络编程API函数初步剖析 今天我们来分析一下前几篇博文中提到的网络编程中几个核心的API,探究一下当我们调用每个API时,内核中具体做了哪些准备和初始化工作. 1.socket(famil ...

  9. SQL SERVER 查询语句学习:CHARINDEX

    场景介绍 项目A需要一个批量删除的功能,之前我一直用SqlTransaction去处理,今天同事告诉我可以用CHARINDEX函数去解决问题,因此我今天就研究了一下. SQL语句 ---定义要删除的数 ...

  10. Python-爬取"我去图书馆"座位编码

    原文地址:http://fanjiajia.cn/2018/11/22/Python-%E7%88%AC%E5%8F%96%E2%80%9D%E6%88%91%E5%8E%BB%E5%9B%BE%E4 ...