PeterNaut's blog

By PeterNaut, history, 8 years ago, In English

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

Full text and comments »

  • Vote: I like it
  • +48
  • Vote: I do not like it

By PeterNaut, 10 years ago, In English

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

Full text and comments »

  • Vote: I like it
  • +9
  • Vote: I do not like it

By PeterNaut, 10 years ago, In English

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

Full text and comments »

  • Vote: I like it
  • +74
  • Vote: I do not like it

By PeterNaut, 10 years ago, In English

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

Link to video: http://www.youtube.com/watch?v=c5m2f4bGtDg

Full text and comments »

  • Vote: I like it
  • -18
  • Vote: I do not like it

By PeterNaut, 10 years ago, In English

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

Full text and comments »

  • Vote: I like it
  • +9
  • Vote: I do not like it

By PeterNaut, 10 years ago, In English

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?

Full text and comments »

  • Vote: I like it
  • +6
  • Vote: I do not like it

By PeterNaut, 10 years ago, In English

Is there even a date yet? Thanks!

Full text and comments »

  • Vote: I like it
  • +17
  • Vote: I do not like it

By PeterNaut, 10 years ago, In English

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

Full text and comments »

  • Vote: I like it
  • +1
  • Vote: I do not like it

By PeterNaut, 11 years ago, In English

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++?

Full text and comments »

Tags c++
  • Vote: I like it
  • -18
  • Vote: I do not like it

By PeterNaut, 11 years ago, In English

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.

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By PeterNaut, 11 years ago, In English

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)?

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By PeterNaut, 11 years ago, In English

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

Full text and comments »

  • Vote: I like it
  • +1
  • Vote: I do not like it

By PeterNaut, 11 years ago, In English

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

Full text and comments »

  • Vote: I like it
  • +33
  • Vote: I do not like it

By PeterNaut, 12 years ago, In English

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

Full text and comments »

  • Vote: I like it
  • -11
  • Vote: I do not like it

By PeterNaut, 12 years ago, In English

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

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By PeterNaut, 12 years ago, In English

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.

Full text and comments »

  • Vote: I like it
  • -6
  • Vote: I do not like it