设为首页 加入收藏

TOP

Codeforces 436 C. Dungeons and Candies(一)
2015-07-24 05:48:32 来源: 作者: 【 】 浏览:10
Tags:Codeforces 436 Dungeons and Candies


MST....

C. Dungeons and Candies time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output

During the loading of the game "Dungeons and Candies" you are required to get descriptions of k levels from the server. Each description is a map of an n?×?m checkered rectangular field. Some cells of the field contain candies (each cell has at most one candy). An empty cell is denoted as "." on the map, but if a cell has a candy, it is denoted as a letter of the English alphabet. A level may contain identical candies, in this case the letters in the corresponding cells of the map will be the same.

\

When you transmit infZ??http://www.2cto.com/kf/ware/vc/" target="_blank" class="keylink">vcm1hdGlvbiB2aWEgYSBuZXR3b3JrLCB5b3Ugd2FudCB0byBtaW5pbWl6ZSB0cmFmZmljIKGqIHRoZSB0b3RhbCBzaXplIG9mIHRoZSB0cmFuc2ZlcnJlZCBkYXRhLiBUaGUgbGV2ZWxzIGNhbiBiZSB0cmFuc21pdHRlZCBpbiBhbnkgb3JkZXIuIFRoZXJlIGFyZSB0d28gd2F5cyB0byB0cmFuc21pdCB0aGUgY3VycmVudCBsZXZlbCA8ZW0+QTwvZW0+OjwvcD4KPG9sPgo8bGk+CllvdSBjYW4gdHJhbnNtaXQgdGhlIHdob2xlIGxldmVsIDxlbT5BPC9lbT4uIFRoZW4geW91IG5lZWQgdG8gdHJhbnNtaXQgPGVtPm48L2VtPqGkPGVtPm08L2VtPiBieXRlcwogdmlhIHRoZSBuZXR3b3JrLjxsaT4KWW91IGNhbiB0cmFuc21pdCB0aGUgZGlmZmVyZW5jZSBiZXR3ZWVuIGxldmVsIDxlbT5BPC9lbT4gYW5kIHNvbWUgcHJldmlvdXNseSB0cmFuc21pdHRlZCBsZXZlbCA8ZW0+QjwvZW0+IChpZgogaXQgZXhpc3RzKTsgdGhpcyBvcGVyYXRpb24gcmVxdWlyZXMgdG8gdHJhbnNtaXQgPGVtPmQ8L2VtPjxlbT5BPC9lbT4sPzxlbT5CPC9lbT6hpD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aW5lIGNvbnRhaW5zIDxlbT5tPC9lbT4gY2hhcmFjdGVycy4gRWFjaCBjaGFyYWN0ZXIgaXMgZWl0aGVyIGEgbGV0dGVyIG9mIHRoZSBFbmdsaXNoIGFscGhhYmV0IG9yIGEgZG90ICg="."). Please note that the case of the letters matters.

Output

In the first line print the required minimum number of transferred bytes.

Then print k pairs of integers x1,?y1,?x2,?y2,?...,?xk,?yk, describing the way to transfer levels. Pair xi, yi means that level xi needs to be transferred by way yi. If yi equals 0, that means that the level must be transferred using the first way, otherwise yi must be equal to the number of a previously transferred level. It means that you will transfer the difference between levels yi and xi to transfer level xi. Print the pairs in the ord

首页 上一页 1 2 下一页 尾页 1/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇uva 11885 - Number of Battlefie.. 下一篇简单工厂模式

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: