模拟
天涯-沧海
acmer
展开
-
(模拟)吉林大学ACM集训队选拔赛(重现赛) I题 Firework
这题直接多源bfs模拟下就好了,想清楚了就挺好写的,可惜比赛的时候没时间做这题了1.一个点u扩展到另一个点v,如果点v之前没扩展到,那t[v](第v个点最早点燃的时刻)=t[u]+2*w2.如果之前v已经被扩展到了,那如果t[v]>=t[u]+2*w,显而易见,t[v]可以更新成t[u]+2*w3.如果t[v]<t[u]+2*w,那说明uv在中间某个点相遇了,那相遇的时刻ans=max(t[u],t[v])+(2*w-abs((t[v]-t[u])))/2;然后所有ans(中间.原创 2020-06-17 23:21:04 · 279 阅读 · 0 评论 -
CodeForces - 1283D Christmas Trees
思路:这题就是从每个圣诞树左右进行扩展,优先近的点做法:每个点设一个坐标id,扩展方向f(+-1),扩展距离s,把每个点放到优先队列里,按照s小的在顶端,map纪录一下扩展过的点,依次从顶端取点扩展就好了There are n Christmas trees on an infinite number line. The i-th tree grows at the position xi. All xiare guaranteed to be distinct.Each intege..原创 2020-06-01 17:28:11 · 245 阅读 · 0 评论 -
(简单写法) Codeforces Round #619 (Div. 2) D. Time to Run
具体走法如上图:先右,然后折回,再向下,在重复直到最后一行,最后一行先向右,然后上再折回,再左,一直重复直到走回原点这个走法模拟并不是难点,难点在与它每步最多四格,然后可以多次重复,步数不能超过3000,如果直接模拟我就看到有博客写到了一两百行,变成了一个大模拟,实际有个简单写法先模拟走一遍,用字符串存起来,这个字符串中前k个,连续相同的字符就可以压缩到一步,然后输出就可以了Bashar was practicing for the national programmi...原创 2020-05-20 01:06:46 · 155 阅读 · 0 评论 -
Icy Land CFGym 102001D
You are given a board of R rows and Ccolumns where each cell is either a dry land ('#') or an icy land ('.'). You can move to either one of the four directions (north, south, east, or west) in the b...原创 2019-10-19 15:43:18 · 368 阅读 · 0 评论 -
CFGym 102299 H Course recommendation
DescriptionOne of the biggest challenges in an online course platform is to recommend to a student one of its over 800 courses.For instance, João took courses on Java and Java for the Web, with gr...原创 2019-10-04 21:51:17 · 145 阅读 · 0 评论 -
Garbage Disposal
DescriptionEnough is enough. Too many times it happened that Vasya forgot to dispose of garbage and his apartment stank afterwards. Now he wants to create a garbage disposal plan and stick to it.F...原创 2019-10-03 21:38:15 · 392 阅读 · 0 评论 -
Codeforces Round #589 (Div. 2) B.Filling the Grid
Suppose there is a h×wgrid consisting of empty or full cells. Let's make some definitions:riis the number of consecutive full cells connected to the left side in the i-th row (1≤i≤h). In parti...原创 2019-09-30 19:56:01 · 299 阅读 · 0 评论 -
Problem B. Memory Banks
DescriptionWe have purchased 60 different types of memory banks, typed as 0 to 59, A bank of type i has 2^i memory capacity. We have Ximemory banks of type i.We also have n workstations numbered ...原创 2019-09-22 18:37:07 · 303 阅读 · 0 评论 -
Codeforces Round #567 (Div. 2) B. Split a Number
time limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputDima worked all day and wrote down on a long paper strip his favorite number nco...原创 2019-06-16 21:08:05 · 689 阅读 · 0 评论 -
Codeforces Round #567 (Div. 2) A. Chunga-Changa
time limit per test1 secondmemory limit per test512 megabytesinputstandard inputoutputstandard outputSoon after the Chunga-Changa island was discovered, it started to acquire some form...原创 2019-06-16 21:01:01 · 308 阅读 · 0 评论 -
Codeforces Round #568 (Div. 2) D. Extra Element
A sequence a1,a2,…,ak is called an arithmetic progression if for each i from 1 to k elements satisfy the condition ai=a1+c⋅(i−1) for some fixed c.For example, these five sequences are arithmetic p...原创 2019-06-20 16:28:55 · 295 阅读 · 0 评论 -
hdu 1002 A + B Problem II
Problem DescriptionI have a very simple problem for you. Given two integers A and B, your job is to calculate the Sum of A + B.InputThe first line of the input contains an integer T(1&l...原创 2019-04-21 17:59:35 · 105 阅读 · 0 评论