### PeterNaut's blog

By PeterNaut, history, 4 years ago,

In my icpc regionals they put this problem (link below), but no one came up with a correct solution that runs in time. Does anyone know a solution? The time limit is 60 seconds.

Do you think it can be solved in time? The official solution is a silly heuristic and it is easy to find test cases to make it give wrong answer.

http://localdoc.scusa.lsu.edu/problems-regional/prb.php?prob=10

• +48

By PeterNaut, 5 years ago,

Something like Div 2. A or B. Sometimes they can be fun to solve :P

• +9

By PeterNaut, 6 years ago,

The answer is trivial and left as an exercise to the reader.

• +74

By PeterNaut, 6 years ago,

I want to share a funny thing I found.

Recently, I was watching very inspirational address speeches of important tech people such as Steve Jobs in Stanford University, Steve Wozniak in Berkeley, Bill Gates in Harvard, and so on. I was feeling very enthusiastic about all of these fabulous talks, so I decided to look on Youtube for an address speech of Mark Zuckerberg.

I clicked on the first video which was "Mark Zuckerberg speech to 8th graders." Clearly, the 8th graders were talking to each other, not caring much about Mark, and the speaker introduced him as "Mark ZuckerMan." All of these while Mark had an expression of "How did I get here?"

Oh Mark, what happened? At least you got your address speech :P

• -18

By PeterNaut, 6 years ago,

Do strings in c++ always end with null? If I have a string str = "hey";, will str[3] always be null? I only care about the index following the last character of the string, that is, I don't care what the value for str[4] is. :P

• +9

By PeterNaut, 6 years ago,

You want to send a message that contains 12 distinct signals and 45 spaces. You want that for any pair of signals in the message, there should be at least 3 spaces between them. How many different messages can you send?

• +6

By PeterNaut, 6 years ago,

Is there even a date yet? Thanks!

• +17

By PeterNaut, 6 years ago,

Is Marrakesh, Morocco a nice place to visit? Will it be a great ICPC?

• +1

By PeterNaut, 6 years ago,

In order to swap two arrays in O(1) you can do this using pointers:

#include <algorithm>
int AA[100], *A=AA, BB[100], *B=BB;
swap(A, B);


But how can you do that for matrixes in C++?

• -18

By PeterNaut, 7 years ago,

Which task needs a straight forward interval tree for its solution? With interval tree I mean the data structure that stores a set of lines and has queries asking which lines touch a certain point x? With no neccesity for updates.

• 0

By PeterNaut, 7 years ago,

Is it wise and feasible to implement an interval tree in a Codeforces round (two hours long)? What about in a 5 hour long contest (ioi)?

• 0

By PeterNaut, 7 years ago,

In a weighted tree, how to find for every node the distance to its farthest node (in linear time)?

• +1

By PeterNaut, 7 years ago,

Which programming problems have you enjoyed the most solving or you like its solution best, etc.?

• +33

By PeterNaut, 7 years ago,

I got two questions:

1) What's the point on clicking the option to make a contest or a problem 'favourite' if you can't see a list of favorites problems/contests?

2) Why do it says 'favourite' instead of 'favorite'? Is it an error or is it something else?

Just wondering :P

• -11

By PeterNaut, 8 years ago,

Hello, I've been waiting for the editorial for this contest and specifically for that problem. Can somebody please tell me the solution? Thx

• 0

By PeterNaut, 8 years ago,

A happy world in which after each Codeforces contest, editorials are immediately published for all problems in both Russian and English. :)

It's hard to think of a better improvement than that one.