ENG  RUSTimus Online Judge
Online Judge
Задачи
Авторы
Соревнования
О системе
Часто задаваемые вопросы
Новости сайта
Форум
Ссылки
Архив задач
Отправить на проверку
Состояние проверки
Руководство
Регистрация
Исправить данные
Рейтинг авторов
Текущее соревнование
Расписание
Прошедшие соревнования
Правила
вернуться в форум

Обсуждение задачи 1005. Куча камней

Hint
Послано Pastafarianist 19 ноя 2011 21:59
This problem can be solved using brute force. The asymptotics is O(n*2^n) but still the time limit is not hit, provided you use bit operations instead of generating arrays. For you beginners, I post my code here, but I strongly recommend to write this on your own first. The language I use is Java; nextInt() function returns the next integer from the input.

[code deleted]

Worst time is 0.187 sec, as reported by Timus.

Edited by moderator 21.10.2019 22:59
Re: Hint
Послано Milena Araujo 22 ноя 2011 01:17
Hi !
Would you mind explaining the if on the second for ?
I mean, how is this putting all different combination of blocks on each pile ?
Thanks :D
Re: Hint
Послано Frankie 29 ноя 2011 15:12
man u're awesome :) solution is great for that kinda bruteforce! just made all those things in cpp myself and got ACd :D

but this problem's still far too hard for the "beginners" tag on which it is right now :)
Re: Hint
Послано IlushaMax 28 мар 2016 16:54
Can anybody translate me this code on C++ or Pascal
Re: Hint
Послано Shah Habibul Imran 17 окт 2018 20:09
Thanks, got AC converting it into C++.