ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Турниры > Epoka Science Olympiad 2016 > задача:


11-P5. 50910 - Flipping Coins

Epoka Science Olympiad 2016

Старт: 11.апр.2016 в 14:07:57
Финиш: 24.апр.2016 в 05:00:00
Турнир завершён!
• Турнирная таблица

Гость
• Вопросы к жюри (2)

Задачи турнира

• 11-2. 50968 - Number of Letters
• 11-3. 50969 - Chef and Feedback
• 11-4. 50970 - Marbles
• 11-5. 50971 - Belote Game
• 11-P1. 50906 - The Smallest Pair
• 11-P2. 50907 - Second Largest
• 11-P3. 50908 - Buy 1 Get 1
• 11-P4. 50909 - Gold Coins
• 11-P5. 50910 - Flipping Coins
• 6-1. 50937 - Calculate the Average
• 6-2. 50938 - Translate Score into Gr...
• 6-3. 50975 - Cinema Tickets
• 6-4. 50942 - Win or Lose
• 6-5. 50943 - Word Game
• 6-P1. 50881 - Exchange the Values
• 6-P3. 50883 - Win or Lose
• 6-P4. 50884 - Area and Perimeter Of...

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.

Flipping Coins

There are N coins kept on the table, numbered from 0 to N - 1. Initially, each coin is kept tails up. You have to perform two types of operations:

1) Flip all coins numbered between A and B inclusive. This is represented by the command "0 A B"

2) Answer how many coins numbered between A and B inclusive are heads up. This is represented by the command "1 A B".

Input:
The first line contains two integers, N and Q. Each of the next Q lines are either of the form "0 A B" or "1 A B" as mentioned above.

Output:
Output 1 line for each of the queries of the form "1 A B" containing the required answer for the corresponding query.

Sample Input1:

Sample Input2:

4 7

1 0 3

0 1 2

1 0 1

1 0 0

0 0 3

1 0 3

1 3 3

3 3

1 0 2

0 1 2

1 0 1

Sample  Output1:

Sample  Output2:

0
1
0
2
1

0

1

 

Для отправки решений необходимо выполнить вход.

www.contester.ru