没有合适的资源?快使用搜索试试~ 我知道了~
首页Codeforces 题库 201-294
Codeforces 题库 201-294
4星 · 超过85%的资源 需积分: 0 17 下载量 105 浏览量
更新于2023-03-16
评论
收藏 4.13MB PDF 举报
Codeforces 题库 201-294 共~500题 codeforces.com版权所有。 程序可提交至该网站评测。
资源详情
资源评论
资源推荐
CODEFORCES PROBLEMSET
#201-#294
2013-4-11
Sorted by Jerry Xu in Shanghai
Codeforces (c) Copyright 2010-2013 Mike Mirzayanov
Codeforces is a Russian website dedicated to competitive programming. It was created and
is currently maintained by group of sportsmen from Saratov State University led by Mikhail
Mirzayanov.
Codeforces provides to all users following main services:
Participation in the short (2-hours) contests, so-called "Codeforces Rounds", held about
once a week;
Ability to solve problems from previous contests for training purposes;
"Polygon" for creating and testing problems;
Kind of social-networking by using of internal public blogs.
Contestants are rated by system similar to ELO. There are usually no prizes for winners,
though 100 winners of 100-th Codeforces Round received a T-Shirt. Some bigger contests
(mostly country internal) are hosted on Codeforces base, among them "Yandex Algorithm
2011", provided by Yandex - one of biggest Russian IT-companies.
Website: Codeforces.com
201A. Clear Symmetry
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output
Consider some square matrix A with side n consisting of zeros and ones. There are
n rows numbered from 1 to n from top to bottom and n columns numbered from 1
to n from left to right in this matrix. We'll denote the element of the matrix which is
located at the intersection of the i-row and the j-th column as A
i, j
.
Let's call matrix A clear if no two cells containing ones have a common side.
Let's call matrix A symmetrical if it matches the matrices formed from it by a
horizontal and/or a vertical reflection. Formally, for each pair (i, j) (1 ≤ i, j ≤ n) both
of the following conditions must be met: A
i, j
= A
n - i + 1, j
and A
i, j
= A
i, n - j + 1
.
Let's define the sharpness of matrix A as the number of ones in it.
Given integer x, your task is to find the smallest positive integer n such that there
exists a clear symmetrical matrix A with side n and sharpness x.
Input
The only line contains a single integer x (1 ≤ x ≤ 100) — the required sharpness of
the matrix.
Output
Print a single number — the sought value of n.
Sample test(s)
Input
4
Output
3
Input
9
Output
5
Note
The figure below shows the matrices that correspond to the samples:
201B. Guess That Car!
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output
A widely known among some people Belarusian sport programmer Yura possesses
lots of information about cars. That is why he has been invited to participate in a
game show called "Guess That Car!".
The game show takes place on a giant parking lot, which is 4n meters long from
north to south and 4m meters wide from west to east. The lot has n + 1 dividing
lines drawn from west to east and m + 1 dividing lines drawn from north to south,
which divide the parking lot into n·m 4 by 4 meter squares. There is a car parked
strictly inside each square. The dividing lines are numbered from 0 to n from north
to south and from 0 to m from west to east. Each square has coordinates (i, j) so
that the square in the north-west corner has coordinates (1, 1) and the square in
the south-east corner has coordinates (n, m). See the picture in the notes for
clarifications.
Before the game show the organizers offer Yura to occupy any of the
(n + 1)·(m + 1) intersection points of the dividing lines. After that he can start
guessing the cars. After Yura chooses a point, he will be prohibited to move along
the parking lot before the end of the game show. As Yura is a car expert, he will
always guess all cars he is offered, it's just a matter of time. Yura knows that to
guess each car he needs to spend time equal to the square of the euclidean
distance between his point and the center of the square with this car, multiplied by
some coefficient characterizing the machine's "rarity" (the rarer the car is, the harder
it is to guess it). More formally, guessing a car with "rarity" c placed in a square
whose center is at distance d from Yura takes c·d
2
seconds. The time Yura spends
on turning his head can be neglected.
It just so happened that Yura knows the "rarity" of each car on the parking lot in
advance. Help him choose his point so that the total time of guessing all cars is the
smallest possible.
Input
The first line contains two integers n and m (1 ≤ n, m ≤ 1000) — the sizes of the
parking lot. Each of the next n lines contains m integers: the j-th number in the i-th
line describes the "rarity" c
ij
(0 ≤ c
ij
≤ 100000) of the car that is located in the
square with coordinates (i, j).
Output
In the first line print the minimum total time Yura needs to guess all offered cars. In
the second line print two numbers l
i
and l
j
(0 ≤ l
i
≤ n, 0 ≤ l
j
≤ m) — the numbers of
dividing lines that form a junction that Yura should choose to stand on at the
beginning of the game show. If there are multiple optimal starting points, print the
point with smaller l
i
. If there are still multiple such points, print the point with smaller
l
j
.
Please do not use the %lld specifier to read or write 64-bit integers in С++. It is
preferred to use the cin, cout streams or the %I64d specifier.
Sample test(s)
Input
2 3
3 4 5
3 9 1
Output
392
1 1
Input
3 4
1 0 0 0
0 0 3 0
0 0 5 5
Output
240
2 3
Note
In the first test case the total time of guessing all cars is equal to
3·8 + 3·8 + 4·8 + 9·8 + 5·40 + 1·40 = 392.
The coordinate system of the field:
201C. Fragile Bridges
time limit per test
2 seconds
剩余699页未读,继续阅读
fei960922
- 粉丝: 0
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- RTL8188FU-Linux-v5.7.4.2-36687.20200602.tar(20765).gz
- c++校园超市商品信息管理系统课程设计说明书(含源代码) (2).pdf
- 建筑供配电系统相关课件.pptx
- 企业管理规章制度及管理模式.doc
- vb打开摄像头.doc
- 云计算-可信计算中认证协议改进方案.pdf
- [详细完整版]单片机编程4.ppt
- c语言常用算法.pdf
- c++经典程序代码大全.pdf
- 单片机数字时钟资料.doc
- 11项目管理前沿1.0.pptx
- 基于ssm的“魅力”繁峙宣传网站的设计与实现论文.doc
- 智慧交通综合解决方案.pptx
- 建筑防潮设计-PowerPointPresentati.pptx
- SPC统计过程控制程序.pptx
- SPC统计方法基础知识.pptx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论1