### accidentallygivenfuck's blog

By accidentallygivenfuck, 6 years ago, ,

I remember that I saw Barcelona 2014 Contest by Petr in CF Gym while taking a look at contests list in clist.by.
Does anyone know where is that contest now?

• +4

By accidentallygivenfuck, 6 years ago, ,

### A. Camel Caravan

There is a caravan of n camels. You are fed up with seeing the same camel day after day. Now you wonder, how many ways are there to reorganize the camels, so that no camel sees the same camel as before?

По пустыне идет караван из n верблюдов. За много дней путешествия надоедает идеть впереди себя одного и того же верблюда. Сколькими способами можно переставить верблюдов так, чтобы впереди каждого шел другой верблюд, чем до этого?

### B. Magic is Might

Given natural number k. Find kth number in the sequence consisting of powers of 2: 2481632...
For example for k = 4 answer is 1.

Задано некоторое натуральное число k. В последовательности 2481632... составленная из степеней 2 найти цифру стояшей на k - ом месте.
Например для k = 4 ответ 1.

### C. Tom Marvolo Riddle

Given n natural numbers. Find smallest natural number, which can not be represented as sum of given numbers, if in the representation one number can be used only once.

Даны n натуральных чисел. Найти минимальное натуральное число, непредставимое суммой никаких из этих чисел, если в сумму каждое исходное число может входить не более одного раза.

### D. Fractions

Given natural number n. Find all irreducible regular fractions where i is in range [1, n - 1].

Дано натуральное число n. Найти все несокротимые правильные дроби, знаменатель которых равен n, а числитель принимaет значения, находящиеся в диапазоне [1...n - 1].

### Time & Memory Limits

You can find details here.

### Natural numbers

I hate problem statements where term "natural number" is used. You can't know if zero is included or not. And when I asked if zero is included or not in TKMNOI, I recieved "10th grade and you don't know that?!", when the whole world doesn't know that.

Note 1: As you may have noticed I couldn't come up with good task names, because these tasks don't deserve good names :D

• +14

By accidentallygivenfuck, 6 years ago, ,

#### A. Bet you can't solve it

You need to build a stairway, which has 1.5 unit height and 4.5 unit width. Each step has to have 0.3 unit height and multiple of 0.5 unit width. How many different ways are there to build such a stairway?

Строится лестница из точки А в точку В. Растояние АС = 4.5м; ВС = 1.5м. Высота ступеньки 0.3м, ширина 0.5м или кратное 0.5м. Сколькими способами можно построить лестницу?

Sample stairway. Original images for description.

#### B. Piece of cake

Given matrix A[1...n][1...m], each element of which is 0, 1, 2 or 3. Find number of 4-ples A[i][j], A[i][j + 1], A[i + 1][j], A[i + 1][j + 1] where these numbers differ from each other.

Данна целочисленная матрица А[1...n][1...m],каждый элемент которой равен 0, 1, 2 или 3.Определить количество четвёрок A[i][j], A[i][j + 1], A[i + 1][j], A[i + 1][j + 1] в котором все элементы различны.

#### C. Strange Problem

Continue the sequence of 3-digit numbers: 215, 717, 316, 512 ...

Продолжить последовательность трёхзначных чисел: 215, 717, 316, 512 ...

#### D. Knights' Invasion

Find a way to place 12 knights so that every cell is either attacked or is owned by a knight.

Найти такую расстановку двенадцати коней на шахматной доске, при котором каждое поле будет находиться под ударом одного из них.

#### Constraints

Participant: What is the limit for N?
Jury Member: N can be anything... The limit for it is infinity...
Participant: But no computer can handle infinity? :D
Jury Member: That is your problem! You should try to solve it for infinity.

But actual tests are the ones that can be calculated by hand.

#### Time limit

Depends on the patience of the juries. Usually around 10 minutes.

#### Memory limit

Free memory available in the PC given to you.

Note1 Original blog title was «Turkmenistan National Olympiad in Informatics sucks». And it really does.

• +23

By accidentallygivenfuck, 6 years ago, ,

Does anyone know how to run CMS in Ubuntu >=12.04?

I need sample session where it shows everything from installing CMS (although I know how to), configuring it correctly (CMS itself, PostgreSQL, ... which I find really confusing) to running a test contest.

I started following instuctions from CMS documentation, but now I am lost.
I know almost nothing about listening to a port, PostgreSQL,...

• +3

By accidentallygivenfuck, 6 years ago, ,

Hi all,
I've been trying to solve this problem at TOJ.
I am recieving TLE for following simple code (I just scan input):

#include <iostream>
#include <algorithm>
using namespace std;

int m, n, res;
int b[500];
int r[500];

int main()
{
while (true) {
cin >> m;
cin >> n;

if (m == 0 && n == 0)
break;

for (int i = 0; i < m; i++)
cin >> b[i];

for (int i = 0; i < n; i++)
cin >> r[i];
}

return 0;
}


If any of you is familiar with (have been solving problems for long time) TOJ, please tell me what is wrong.

• +4

By accidentallygivenfuck, 6 years ago, ,

This Saturday we have Topcoder SRM 600. Lets discuss problems here or here. :)

Good luck!

UPD: T-shirt winners :|

• +11

By accidentallygivenfuck, 6 years ago, ,

Today I decided to practice in Topcoder Practice Rooms for the first time. And I opened Topcoder Arena. What I first felt is a big dissappointment about its interface. It was so ugly, it reminded me gaming communities such as RGC,... I want to know what you feel about TC Arena's UI. Maybe someone can request TC admins to change their UI. :(

EDIT: I take my words back. Web Arena is cool!

• -40

By accidentallygivenfuck, 6 years ago, ,

Today I realized that I cannot implement GCD segment tree with range update & range query, the same way I did for min/max/sum segtree with range update & range query. Now I wonder is it possible to write this kind of segment tree with O(logN) complexity for each operation? Operations:

• Add some number x to range [l, r]
• Find GCD of range [l, r]

P.S. not to be confused with:

• Initialize each number in range [l, r] to x
• Find GCD of range [l, r]

• 0

By accidentallygivenfuck, 6 years ago, ,

Hi all,

Currently I'm trying to write simple online judge. I'm having troubles in manipulating processes, detecting TLE, MLE, ... Maybe you can help me in some way, maybe by providing link to some open source online judge, or answering me here.

EDIT : I mistyped the title Wri**n**ting Online Judge in PHP. I can't believe that I didn't notice :)

• 0

By accidentallygivenfuck, 6 years ago, ,

Today while searching for CEOI 2012 Results, I spotted this, and I wanna share it with you :) ...

#### Funny Computer Quotes

“Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.” Rich Cook.

“The perfect computer has been developed. You just feed in your problems and they never come out again.” Al Goodman.

“If the automobile had followed the same development cycle as the computer, a Rolls-Royce would today cost \$100, get a million miles per gallon, and explode once a year, killing everyone inside.” Robert X. Cringely.

“If debugging is the process of removing bugs, then programming must be the process of putting them in.”

“There are 10 types of people in the world: those who understand binary, and those who don’t.”

“My software never has bugs. It just develops random features.”

“Programmers are tools for converting caffeine into code.”

“If at first you don’t succeed; call it version 1.0″

• +27

By accidentallygivenfuck, 6 years ago, ,

Hi,
Some of you may know that in January 12-18 International Zhautykov Olympiad will be held. I heard that in contest environment, there is only CodeBlocks available. Is it really true?

If YES can you please reply asap, so that I can get familiar with CodeBlocks beforehand.

If NO which editors are (or will be) available this year?

• +8

By accidentallygivenfuck, 6 years ago, ,
 Screenshot from 09/21/2013 03:13AM Screenshot from 09/26/2013 08:51AM

Maybe somebody hacked Codeforces and DROPPED/EMPTIED some TABLE :)

• -27

By accidentallygivenfuck, 6 years ago, ,

Problem link : 340E - Яхуб и перестановки
Can anyone prove following:

dp[i] = (y+i-1)*dp[i-1] + (i-1)*dp[i-2];


This is an AC solution by becauseofyou : 4384292

• +7

By accidentallygivenfuck, 7 years ago, ,

Hi everybody. Does anybody know a way how to test your program in Linux. I know how to do it in Windows 7.

For example (file gr.bat) ::

copy <input_file_name_in_test_data>.in.%1 <input_file_name_default>.in
<executable_file_name>
fc <output_file_name_in_test_data>.out.%1 <output_file_name_default>.out


(you can set the syntax yourself)

to test just enter in cmd gr 1 , gr 2 , ... or gr x for test x.

UPD: LOTS OF THANKS to razimantv and Xerxes. [SOLVED]

• +3

By accidentallygivenfuck, 7 years ago, ,

A few hours ago i was surfing the WWW and saw codeforces article at wikipedia. And the article is in danger of extinction. Please edit the article and help to keep honor of codeforces. Here is a link.