CodeForces Round
CodeForces Round 199 Div2
完了,这次做扯了,做的时候有点发烧,居然只做出来一道题,差点被绿.
| # | When | Who | Problem | Lang | Verdict | Time | Memory |
|---|---|---|---|---|---|---|---|
| 4434550 | Sep 9, 2013 11:57:20 AM | OIer | E - Xenia and Tree | GNU C++ | Accepted | 842 ms | 4260 KB |
| 4434547 | Sep 9, 2013 11:56:11 AM | OIer | E - Xenia and Tree | GNU C++ | Wrong answer on test 4 | 280 ms | 3400 KB |
| 4434544 | Sep 9, 2013 11:54:50 AM | OIer | E - Xenia and Tree | GNU C++ | Memory limit exceeded on test 4 | 966 ms | 262100 KB |
| 4434534 | Sep 9, 2013 11:50:15 AM | OIer | E - Xenia and Tree | GNU C++ | Memory limit exceeded on test 4 | 748 ms | 262100 KB |
| 4434506 | Sep 9, 2013 11:33:28 AM | OIer | E - Xenia and Tree | GNU C++ | Time limit exceeded on test 19 | 5000 ms | 4200 KB |
| 4434474 | Sep 9, 2013 11:15:59 AM | OIer | E - Xenia and Tree | GNU C++ | Accepted | 748 ms | 3600 KB |
| 4434179 | Sep 9, 2013 8:45:13 AM | OIer | D - Xenia and Dominoes | GNU C++ | Accepted | 30 ms | 600 KB |
| 4431354 | Sep 8, 2013 1:42:22 PM | OIer | C - Cupboard and Balloons | GNU C++ | Accepted | 30 ms | 0 KB |
| 4431256 | Sep 8, 2013 1:16:19 PM | OIer | C - Cupboard and Balloons | GNU C++ | Wrong answer on test 17 | 30 ms | 0 KB |
| 4431247 | Sep 8, 2013 1:14:03 PM | OIer | B - Xenia and Spies | GNU C++ | Accepted | 124 ms | 1200 KB |
| 4431244 | Sep 8, 2013 1:13:33 PM | OIer | B - Xenia and Spies | GNU C++ | Wrong answer on test 1 | 0 ms | 1300 KB |
| 4431210 | Sep 8, 2013 1:00:11 PM | OIer | B - Xenia and Spies | GNU C++ | Wrong answer on test 3 | 30 ms | 1100 KB |
| # | When | Who | Problem | Lang | Verdict | Time | Memory |
|---|---|---|---|---|---|---|---|
| 4424854 | Sep 7, 2013 1:53:25 PM | OIer | B - Xenia and Spies | GNU C++ | Wrong answer on pretest 2 | 30 ms | 1100 KB |
| 4424797 | Sep 7, 2013 1:52:36 PM | OIer | B - Xenia and Spies | GNU C++ | Wrong answer on pretest 1 | 0 ms | 1300 KB |
| 4422952 | Sep 7, 2013 1:21:08 PM | OIer | A - Xenia and Divisors | GNU C++ | Accepted | 30 ms | 400 KB |
| 4422863 | Sep 7, 2013 1:19:32 PM | OIer | C - Cupboard and Balloons | GNU C++ | Hacked | 30 ms | 0 KB |
| 4422366 | Sep 7, 2013 1:11:51 PM | OIer | C - Cupboard and Balloons | GNU C++ | Wrong answer on pretest 6 | 30 ms | 0 KB |
| 4420785 | Sep 7, 2013 12:50:12 PM | OIer | C - Cupboard and Balloons | GNU C++ | Wrong answer on pretest 6 | 30 ms | 0 KB |
| 4417237 | Sep 7, 2013 12:10:37 PM | OIer | A - Xenia and Divisors | GNU C++ | Hacked | 30 ms | 400 KB |
2 seconds
256 megabytes
standard input
standard output
Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a, b, c the following conditions held:
- a < b < c;
- a divides b, b divides c.
Naturally, Xenia wants each element of the sequence to belong to exactly one group of three. Thus, if the required partition exists, then it has
groups of three.
Help Xenia, find the required partition or else say that it doesn't exist.
The first line contains integer n (3 ≤ n ≤ 99999) — the number of elements in the sequence. The next line contains n positive integers, each of them is at most 7.
It is guaranteed that n is divisible by 3.
If the required partition exists, print
groups of three. Print each group as values of the elements it contains. You should print values in increasing order. Separate the groups and integers in groups by whitespaces. If there are multiple solutions, you can print any of them.
If there is no solution, print -1.
2 seconds
256 megabytes
standard input
standard output
Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the note to one of his neighbours in the row. In other words, if this spy's number is x, he can pass the note to another spy, either x - 1 or x + 1 (if x = 1 or x = n, then the spy has only one neighbour). Also during a step the spy can keep a note and not pass it to anyone.
But nothing is that easy. During m steps Xenia watches some spies attentively. Specifically, during step ti (steps are numbered from 1) Xenia watches spies numbers li, li + 1, li + 2, ..., ri (1 ≤ li ≤ ri ≤ n). Of course, if during some step a spy is watched, he can't do anything: neither give the note nor take it from some other spy. Otherwise, Xenia reveals the spies' cunning plot. Nevertheless, if the spy at the current step keeps the note, Xenia sees nothing suspicious even if she watches him.
You've got s and f. Also, you have the steps during which Xenia watches spies and which spies she is going to watch during each step. Find the best way the spies should act in order to pass the note from spy s to spy f as quickly as possible (in the minimum number of steps).
The first line contains four integers n, m, s and f (1 ≤ n, m ≤ 105; 1 ≤ s, f ≤ n; s ≠ f; n ≥ 2). Each of the following m lines contains three integers ti, li, ri (1 ≤ ti ≤ 109, 1 ≤ li ≤ ri ≤ n). It is guaranteed that t1 < t2 < t3 < ... < tm.
Print k characters in a line: the i-th character in the line must represent the spies' actions on step i. If on step i the spy with the note must pass the note to the spy with a lesser number, the i-th character should equal "L". If on step i the spy with the note must pass it to the spy with a larger number, the i-th character must equal "R". If the spy must keep the note at the i-th step, the i-th character must equal "X".
As a result of applying the printed sequence of actions spy s must pass the note to spy f. The number of printed characters k must be as small as possible. Xenia must not catch the spies passing the note.
If there are miltiple optimal solutions, you can print any of them. It is guaranteed that the answer exists.
2 seconds
256 megabytes
standard input
standard output
A girl named Xenia has a cupboard that looks like an arc from ahead. The arc is made of a semicircle with radius r (the cupboard's top) and two walls of height h (the cupboard's sides). The cupboard's depth is r, that is, it looks like a rectangle with base r and height h + r from the sides. The figure below shows what the cupboard looks like (the front view is on the left, the side view is on the right).

Xenia got lots of balloons for her birthday. The girl hates the mess, so she wants to store the balloons in the cupboard. Luckily, each balloon is a sphere with radius
. Help Xenia calculate the maximum number of balloons she can put in her cupboard.
You can say that a balloon is in the cupboard if you can't see any part of the balloon on the left or right view. The balloons in the cupboard can touch each other. It is not allowed to squeeze the balloons or deform them in any way. You can assume that the cupboard's walls are negligibly thin.
The single line contains two integers r, h (1 ≤ r, h ≤ 107).
Print a single integer — the maximum number of balloons Xenia can put in the cupboard.
2 seconds
256 megabytes
standard input
standard output
Xenia likes puzzles very much. She is especially fond of the puzzles that consist of domino pieces. Look at the picture that shows one of such puzzles.

A puzzle is a 3 × n table with forbidden cells (black squares) containing dominoes (colored rectangles on the picture). A puzzle is called correct if it meets the following conditions:
- each domino occupies exactly two non-forbidden cells of the table;
- no two dominoes occupy the same table cell;
- exactly one non-forbidden cell of the table is unoccupied by any domino (it is marked by a circle in the picture).
To solve the puzzle, you need multiple steps to transport an empty cell from the starting position to some specified position. A move is transporting a domino to the empty cell, provided that the puzzle stays correct.The horizontal dominoes can be moved only horizontally, and vertical dominoes can be moved only vertically. You can't rotate dominoes. The picture shows a probable move.
Xenia has a 3 × n table with forbidden cells and a cell marked with a circle. Also, Xenia has very many identical dominoes. Now Xenia is wondering, how many distinct correct puzzles she can make if she puts dominoes on the existing table. Also, Xenia wants the circle-marked cell to be empty in the resulting puzzle. The puzzle must contain at least one move.
Help Xenia, count the described number of puzzles. As the described number can be rather large, print the remainder after dividing it by 1000000007 (109 + 7).
The first line contains integer n (3 ≤ n ≤ 104) — the puzzle's size. Each of the following three lines contains n characters — the description of the table. The j-th character of the i-th line equals "X" if the corresponding cell is forbidden; it equals ".", if the corresponding cell is non-forbidden and "O", if the corresponding cell is marked with a circle.
It is guaranteed that exactly one cell in the table is marked with a circle. It is guaranteed that all cells of a given table having at least one common point with the marked cell is non-forbidden.
Print a single number — the answer to the problem modulo 1000000007 (109 + 7).
题意:有一个3*n的矩形,除其中标为X或O的点之外的点用1*2的矩形覆盖,求有多少种发难.要求标为O的点周围存在可以移动的1*2矩形.
思路:位DP?还是状态压缩?我不太清楚这分类.f[i][j]表示填充到第i列,状态为j的方案数.其中j∈[0,7],其二进制表示第k行是否被占用.因为O点周围必须有能移动的小矩形,所以枚举小矩形的位置,分别有可能在左右或下.然后用容斥原理排除多余解.
5 seconds
256 megabytes
standard input
standard output
Xenia the programmer has a tree consisting of n nodes. We will consider the tree nodes indexed from 1 to n. We will also consider the first node to be initially painted red, and the other nodes — to be painted blue.
The distance between two tree nodes v and u is the number of edges in the shortest path between v and u.
Xenia needs to learn how to quickly execute queries of two types:
- paint a specified blue node in red;
- calculate which red node is the closest to the given one and print the shortest distance to the closest red node.
Your task is to write a program which will execute the described queries.
The first line contains two integers n and m (2 ≤ n ≤ 105, 1 ≤ m ≤ 105) — the number of nodes in the tree and the number of queries. Next n - 1 lines contain the tree edges, the i-th line contains a pair of integers ai, bi(1 ≤ ai, bi ≤ n, ai ≠ bi) — an edge of the tree.
Next m lines contain queries. Each query is specified as a pair of integers ti, vi (1 ≤ ti ≤ 2, 1 ≤ vi ≤ n). If ti = 1, then as a reply to the query we need to paint a blue node vi in red. If ti = 2, then we should reply to the query by printing the shortest distance from some red node to node vi.
It is guaranteed that the given graph is a tree and that all queries are correct.
For each second type query print the reply in a single line.
1 2
2 3
2 4
4 5
2 1
2 5
1 2
2 5
CodeForces Round的更多相关文章
- Codeforces Round #366 (Div. 2) ABC
Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate ...
- Codeforces Round #354 (Div. 2) ABCD
Codeforces Round #354 (Div. 2) Problems # Name A Nicholas and Permutation standard input/out ...
- Codeforces Round #368 (Div. 2)
直达–>Codeforces Round #368 (Div. 2) A Brain’s Photos 给你一个NxM的矩阵,一个字母代表一种颜色,如果有”C”,”M”,”Y”三种中任意一种就输 ...
- cf之路,1,Codeforces Round #345 (Div. 2)
cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅..... ...
- Codeforces Round #279 (Div. 2) ABCDE
Codeforces Round #279 (Div. 2) 做得我都变绿了! Problems # Name A Team Olympiad standard input/outpu ...
- Codeforces Round #262 (Div. 2) 1003
Codeforces Round #262 (Div. 2) 1003 C. Present time limit per test 2 seconds memory limit per test 2 ...
- Codeforces Round #262 (Div. 2) 1004
Codeforces Round #262 (Div. 2) 1004 D. Little Victor and Set time limit per test 1 second memory lim ...
- Codeforces Round #370 - #379 (Div. 2)
题意: 思路: Codeforces Round #370(Solved: 4 out of 5) A - Memory and Crow 题意:有一个序列,然后对每一个进行ai = bi - bi ...
- Codeforces Round #371 (Div. 1)
A: 题目大意: 在一个multiset中要求支持3种操作: 1.增加一个数 2.删去一个数 3.给出一个01序列,问multiset中有多少这样的数,把它的十进制表示中的奇数改成1,偶数改成0后和给 ...
- Codeforces Round #284 (Div. 2)A B C 模拟 数学
A. Watching a movie time limit per test 1 second memory limit per test 256 megabytes input standard ...
随机推荐
- java OutOfMorryError (replaceAll)
最近在使用string类中的replaceAll函数时碰到这个错误,由于string长度比较长,文本文档9M多,可以增加jvm的内存大小解决. 下面是一篇对OutOfMorryError错误的一些处理 ...
- 浅谈 js 字符串之神奇的转义
原文:浅谈 js 字符串之神奇的转义 字符串在js里是非常常用的,但是你真的了解它么?翻阅<MDN String>就可以了解它的常见用法了,开门见山的就让你了解了字符串是怎么回事. 'st ...
- 【百度地图API】如何制作商圈地图?行政地图?
原文:[百度地图API]如何制作商圈地图?行政地图? 摘要: 想要显示某一个区域,并且鼠标放上去,该区域就会变色.这时,你就需要巧用多边形覆盖物,和它的鼠标事件了! 快来看看去哪儿网的实例吧:http ...
- Swift语言指南(五)--数字字面量和数字类型转换
原文:Swift语言指南(五)--数字字面量和数字类型转换 数字字面量 整数字面量写法如下: · 十进制数,无前缀 · 二进制数,以 0b 为前缀 · 八进制数,以 0o 为前缀 · 十六进制数,以 ...
- linux虚拟文件系统2
转自:http://rstevens.iteye.com/blog/849413 一.概述 Linux 文件系统是相当复杂的,本文只分析虚拟文件系统的实现,对具体的文件系统不涉及. 即使是虚拟文件系统 ...
- [Android]Parcelable encountered IOException writing serializable object (name = xxx)
Activity之间通过Intent传递值,支持基本数据类型和String对象及它们的数组对象byte.byte[].char.char[].boolean.boolean[].short.short ...
- Android-Universal-Image-Loader学习笔记(两)--LruDiscCache
最近最少使用缓存官员最近(LruDiscCache)之前,引入一个概念,一个重要的三个班: key:这是DiscCacheAware接口save里面的方法imageUri通过调用参数FileNameG ...
- 《MonkeyRunner原理剖析》第九章-MonkeyImage实现原理 - 第一节 - 关键类作用及关系
MonkeyRunner框架暴露了几个类的大量的API出去给用户编写脚本时候使用,其中最主要的三个就是: MonkeyDevice目标设备操作类,HierarchyViewer窗口界面对象操作类以及M ...
- 基于Asterisk的VoIP开发指南——(1)实现基本呼叫功能
原文:基于Asterisk的VoIP开发指南--(1)实现基本呼叫功能 说明: 1.本文档探讨基于Asterisk如何实现VoIP的一些基本功能,包括基本呼叫功能的方案选取.主叫号码透传.如何编写As ...
- Linux内核头文件与内核与库的关系
看上一篇文章中对buildroot的介绍,里面的文档第 3.1.1.1 Internal toolchain backend 节内容 C库会去访问Linux kernel headers(*.h)文件 ...