結果

問題 No.5003 物理好きクリッカー
ユーザー tailstails
提出日時 2018-12-11 17:20:39
言語 C++11
(gcc 11.4.0)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 19,776 bytes
コンパイル時間 657 ms
実行使用メモリ 22,008 KB
スコア 0
平均クエリ数 1.00
最終ジャッジ日時 2021-07-19 09:21:48
合計ジャッジ時間 21,341 ms
ジャッジサーバーID
(参考情報)
judge10 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘void init()’:
main.cpp:423:13: warning: ‘char* gets(char*)’ is deprecated [-Wdeprecated-declarations]
  gets(events);
             ^
In file included from main.cpp:2:
/usr/include/stdio.h:583:14: note: declared here
 extern char *gets (char *__s) __wur __attribute_deprecated__;
              ^~~~
main.cpp:423:13: warning: ‘char* gets(char*)’ is deprecated [-Wdeprecated-declarations]
  gets(events);
             ^
In file included from main.cpp:2:
/usr/include/stdio.h:583:14: note: declared here
 extern char *gets (char *__s) __wur __attribute_deprecated__;
              ^~~~
main.cpp: In member function ‘bool Solver::runto(int)’:
main.cpp:275:2: warning: control reaches end of non-void function [-Wreturn-type]
  }
  ^
/tmp/cc68EuqF.o: In function `init()':
main.cpp:(.text+0xef): warning: the `gets' function is dangerous and should not be used.

ソースコード

diff #

#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <map>

typedef long long cookie_t;

char const fnames[][16]={"hand","lily","factory","casino","grimoire"};
cookie_t const bspeeds[]={1,10,120,2000,25000};
cookie_t const bprices[]={150,2000,30000,600000,10000000};

cookie_t pricess[11][64];

char range[][22]={
{1,1,  0, 0, 0,0,  0, 0, 0,0,  0, 0, 0,0,  0, 0, 0,0,  0, 0, 0,0, },
{2,2,  0, 0, 0,0,  0, 0, 0,0,  0, 0, 0,0,  0, 0, 0,0,  0, 0, 0,0, },
{2,2,  1, 1, 0,0,  0, 0, 0,0,  0, 0, 0,0,  0, 0, 0,0,  0, 0, 0,0, },
{2,2,  2, 2, 0,0,  0, 0, 0,0,  0, 0, 0,0,  0, 0, 0,0,  0, 0, 0,0, },
{2,2,  3, 3, 0,0,  0, 0, 0,0,  0, 0, 0,0,  0, 0, 0,0,  0, 0, 0,0, },
{2,2,  4, 4, 0,0,  0, 0, 0,0,  0, 0, 0,0,  0, 0, 0,0,  0, 0, 0,0, },
{2,2,  4, 5, 0,1,  0, 1, 0,0,  0, 0, 0,0,  0, 0, 0,0,  0, 0, 0,0, },
{2,2,  4, 6, 0,1,  0, 1, 0,0,  0, 0, 0,0,  0, 0, 0,0,  0, 0, 0,0, },
{2,2,  5, 7, 0,1,  0, 1, 0,0,  0, 0, 0,0,  0, 0, 0,0,  0, 0, 0,0, },
{2,2,  6, 7, 1,1,  0, 1, 0,0,  0, 0, 0,0,  0, 0, 0,0,  0, 0, 0,0, },
{2,2,  6, 8, 1,1,  0, 2, 0,0,  0, 0, 0,0,  0, 0, 0,0,  0, 0, 0,0, },
{2,2,  7, 9, 1,1,  0, 2, 0,0,  0, 0, 0,0,  0, 0, 0,0,  0, 0, 0,0, },
{2,2,  8, 9, 1,1,  1, 2, 0,0,  0, 0, 0,0,  0, 0, 0,0,  0, 0, 0,0, },
{2,2,  8, 9, 1,1,  2, 3, 0,0,  0, 0, 0,0,  0, 0, 0,0,  0, 0, 0,0, },
{2,2,  8,10, 1,1,  2, 4, 0,0,  0, 0, 0,0,  0, 0, 0,0,  0, 0, 0,0, },
{2,3,  8,11, 1,1,  2, 5, 0,0,  0, 0, 0,0,  0, 0, 0,0,  0, 0, 0,0, },
{2,3,  9,11, 1,1,  3, 5, 0,0,  0, 0, 0,0,  0, 0, 0,0,  0, 0, 0,0, },
{2,3,  9,11, 1,1,  3, 5, 0,0,  0, 0, 0,0,  0, 0, 0,0,  0, 0, 0,0, },
{2,3,  9,11, 1,1,  4, 6, 0,1,  0, 0, 0,0,  0, 0, 0,0,  0, 0, 0,0, },
{2,3,  9,12, 1,1,  4, 6, 0,1,  0, 0, 0,0,  0, 0, 0,0,  0, 0, 0,0, },
{2,3,  9,12, 1,1,  4, 7, 0,1,  0, 1, 0,0,  0, 0, 0,0,  0, 0, 0,0, },
{2,3,  9,12, 1,1,  5, 8, 0,1,  0, 1, 0,0,  0, 0, 0,0,  0, 0, 0,0, },
{2,3,  9,12, 1,1,  5, 8, 0,1,  0, 1, 0,0,  0, 0, 0,0,  0, 0, 0,0, },
{2,3,  9,13, 1,1,  5, 8, 0,1,  0, 2, 0,0,  0, 0, 0,0,  0, 0, 0,0, },
{2,3, 10,13, 1,1,  6, 9, 1,1,  0, 2, 0,0,  0, 0, 0,0,  0, 0, 0,0, },
{2,3, 10,14, 1,1,  7, 9, 1,1,  0, 3, 0,0,  0, 0, 0,0,  0, 0, 0,0, },
{2,3, 10,14, 1,1,  7, 9, 1,1,  0, 3, 0,0,  0, 0, 0,0,  0, 0, 0,0, },
{2,3, 10,14, 1,1,  8,10, 1,1,  1, 4, 0,0,  0, 0, 0,0,  0, 0, 0,0, },
{2,3, 10,14, 1,1,  8,10, 1,1,  2, 4, 0,0,  0, 0, 0,0,  0, 0, 0,0, },
{2,3, 11,14, 1,2,  8,10, 1,1,  2, 4, 0,0,  0, 0, 0,0,  0, 0, 0,0, },
{2,3, 11,14, 1,2,  9,11, 1,1,  2, 5, 0,0,  0, 0, 0,0,  0, 0, 0,0, },
{2,3, 12,14, 1,2,  9,11, 1,1,  2, 5, 0,0,  0, 0, 0,0,  0, 0, 0,0, },
{2,3, 12,15, 1,2,  9,11, 1,1,  3, 6, 0,1,  0, 0, 0,0,  0, 0, 0,0, },
{2,3, 12,15, 1,2,  9,12, 1,1,  4, 6, 0,1,  0, 0, 0,0,  0, 0, 0,0, },
{2,3, 12,16, 1,2,  9,12, 1,1,  4, 7, 0,1,  0, 0, 0,0,  0, 0, 0,0, },
{2,3, 13,16, 1,2,  9,12, 1,1,  4, 7, 0,1,  0, 0, 0,0,  0, 0, 0,0, },
{2,3, 13,17, 1,2,  9,12, 1,1,  4, 8, 0,1,  0, 0, 0,0,  0, 0, 0,0, },
{2,3, 13,17, 1,2,  9,12, 1,1,  4, 8, 0,1,  0, 0, 0,0,  0, 0, 0,0, },
{2,3, 13,17, 1,2,  9,12, 1,1,  4, 9, 0,1,  0, 0, 0,0,  0, 0, 0,0, },
{2,3, 14,17, 1,2,  9,12, 1,1,  5, 9, 0,1,  0, 1, 0,0,  0, 0, 0,0, },
{2,3, 14,18, 1,2, 10,12, 1,1,  5, 9, 0,1,  0, 1, 0,0,  0, 0, 0,0, },
{2,3, 15,18, 1,2, 10,12, 1,1,  6, 9, 0,1,  0, 2, 0,0,  0, 0, 0,0, },
{2,3, 15,19, 1,2, 10,12, 1,1,  6, 9, 0,1,  0, 2, 0,0,  0, 0, 0,0, },
{2,3, 15,19, 1,2, 10,12, 1,1,  7, 9, 1,1,  0, 3, 0,0,  0, 0, 0,0, },
{2,3, 15,19, 2,2, 10,13, 1,1,  7, 9, 1,1,  0, 4, 0,0,  0, 0, 0,0, },
{2,3, 16,19, 2,2, 10,13, 1,1,  8,10, 1,1,  0, 4, 0,0,  0, 0, 0,0, },
{2,3, 16,20, 2,2, 10,13, 1,1,  8,10, 1,1,  0, 4, 0,0,  0, 0, 0,0, },
{2,3, 16,20, 2,2, 10,13, 1,1,  8,10, 1,1,  0, 4, 0,0,  0, 0, 0,0, },
{2,3, 16,20, 2,2, 11,13, 1,1,  8,10, 1,1,  0, 5, 0,0,  0, 0, 0,0, },
{2,3, 16,21, 2,2, 11,14, 1,1,  8,10, 1,1,  0, 6, 0,0,  0, 0, 0,0, },
{2,3, 17,21, 2,2, 11,14, 1,1,  8,11, 1,1,  1, 6, 0,0,  0, 0, 0,0, },
{2,3, 17,21, 2,2, 11,14, 1,2,  8,11, 1,1,  1, 6, 0,1,  0, 0, 0,0, },
{2,3, 17,22, 2,2, 11,14, 1,2,  9,11, 1,1,  2, 7, 0,1,  0, 0, 0,0, },
{2,3, 17,22, 2,2, 12,14, 1,2,  9,11, 1,1,  3, 8, 0,1,  0, 0, 0,0, },
{2,3, 17,22, 2,2, 12,14, 1,2,  9,12, 1,1,  3, 8, 0,1,  0, 0, 0,0, },
{2,3, 17,22, 2,2, 12,14, 1,2,  9,12, 1,1,  4, 8, 0,1,  0, 1, 0,0, },
{2,3, 17,22, 2,2, 12,14, 1,2,  9,12, 1,1,  5, 9, 0,1,  0, 1, 0,0, },
{2,3, 17,22, 2,2, 12,15, 1,2,  9,12, 1,1,  5, 9, 0,1,  0, 2, 0,0, },
{2,3, 17,22, 2,2, 12,16, 1,2,  9,12, 1,1,  5,10, 0,1,  0, 2, 0,0, },
{2,3, 17,22, 2,2, 12,16, 1,2,  9,12, 1,1,  5,10, 0,1,  0, 3, 0,0, },
{2,3, 17,22, 2,2, 12,16, 1,2, 10,12, 1,1,  5,10, 0,1,  0, 3, 0,0, },
{2,3, 17,22, 2,2, 13,17, 1,2, 10,12, 1,1,  6,10, 0,1,  0, 3, 0,0, },
{2,3, 17,22, 2,2, 13,17, 1,2, 10,13, 1,1,  6,10, 0,1,  0, 3, 0,0, },
{2,3, 17,22, 2,2, 13,17, 1,2, 10,13, 1,1,  6,10, 0,1,  0, 3, 0,0, },
{2,3, 17,22, 2,2, 13,17, 1,2, 10,14, 1,1,  7,11, 1,1,  0, 3, 0,0, },
{2,3, 17,22, 2,2, 13,17, 1,2, 10,14, 1,1,  7,11, 1,1,  0, 4, 0,0, },
{2,3, 17,22, 2,2, 13,17, 1,2, 10,14, 1,1,  8,11, 1,1,  0, 4, 0,0, },
{2,3, 17,23, 2,2, 14,18, 1,2, 10,14, 1,1,  8,11, 1,1,  0, 5, 0,0, },
{2,3, 17,23, 2,2, 14,18, 1,2, 10,14, 1,1,  8,11, 1,1,  0, 5, 0,0, },
{2,3, 18,23, 2,2, 14,18, 1,2, 11,14, 1,1,  8,12, 1,1,  0, 5, 0,0, },
{2,3, 18,23, 2,2, 14,18, 1,2, 11,14, 1,2,  8,12, 1,1,  0, 5, 0,0, },
{2,3, 18,23, 2,2, 14,18, 1,2, 11,14, 1,2,  8,12, 1,1,  0, 5, 0,1, },
{2,3, 18,23, 2,2, 15,19, 1,2, 11,15, 1,2,  8,12, 1,1,  1, 6, 0,1, },
{2,3, 18,24, 2,2, 15,19, 2,2, 11,15, 1,2,  8,12, 1,1,  2, 7, 0,1, },
{2,3, 18,24, 2,2, 16,19, 2,2, 11,16, 1,2,  9,12, 1,1,  2, 7, 0,1, },
{2,3, 18,24, 2,2, 16,19, 2,2, 11,16, 1,2,  9,12, 1,1,  2, 7, 0,1, },
{2,3, 18,24, 2,2, 16,19, 2,2, 12,16, 1,2,  9,12, 1,1,  2, 7, 0,1, },
{2,3, 18,24, 2,2, 16,20, 2,2, 12,16, 1,2,  9,12, 1,1,  2, 7, 0,1, },
{2,3, 18,24, 2,2, 16,21, 2,2, 13,16, 1,2,  9,12, 1,1,  2, 7, 0,1, },
{2,3, 18,24, 2,2, 16,21, 2,2, 13,16, 1,2,  9,12, 1,1,  3, 8, 0,1, },
{2,3, 18,24, 2,2, 17,21, 2,2, 13,17, 1,2, 10,12, 1,1,  3, 9, 0,1, },
{2,3, 18,24, 2,2, 17,21, 2,2, 13,17, 1,2, 10,12, 1,1,  3, 9, 0,1, },
{2,3, 18,24, 2,2, 17,21, 2,2, 13,17, 1,2, 10,12, 1,1,  3,10, 0,1, },
{2,3, 18,24, 2,2, 17,21, 2,2, 14,17, 1,2, 11,12, 1,1,  4,10, 0,1, },
{2,3, 18,24, 2,2, 17,22, 2,2, 14,17, 1,2, 11,12, 1,1,  5,10, 0,1, },
{2,3, 18,24, 2,3, 18,23, 2,2, 14,18, 1,2, 11,13, 1,1,  5,10, 0,1, },
{2,3, 18,24, 2,3, 18,23, 2,2, 14,18, 1,2, 11,13, 1,1,  5,10, 0,1, },
{2,3, 18,24, 2,3, 18,23, 2,2, 14,18, 1,2, 11,13, 1,1,  5,10, 0,1, },
{2,3, 18,24, 2,3, 18,23, 2,2, 14,18, 1,2, 11,13, 1,2,  6,10, 0,1, },
{2,3, 19,24, 2,3, 18,23, 2,2, 15,19, 1,2, 11,13, 1,2,  6,10, 0,1, },
{2,3, 20,24, 2,3, 18,23, 2,2, 16,19, 1,2, 11,14, 1,2,  7,11, 0,1, },
{2,3, 20,24, 2,3, 18,23, 2,2, 16,19, 1,2, 11,14, 1,2,  7,11, 0,1, },
{2,3, 20,25, 2,3, 18,24, 2,2, 16,19, 1,2, 11,15, 1,2,  7,11, 0,1, },
{2,3, 20,26, 2,3, 18,24, 2,2, 16,19, 1,2, 11,16, 1,2,  7,11, 0,1, },
{2,4, 20,26, 2,3, 18,24, 2,2, 16,19, 2,2, 11,16, 1,2,  7,11, 0,1, },
{2,4, 20,26, 2,3, 18,24, 2,2, 16,19, 2,2, 12,16, 1,2,  7,12, 1,1, },
{2,4, 20,27, 2,3, 19,24, 2,2, 16,19, 2,2, 12,17, 1,2,  8,12, 1,1, },
{2,4, 20,27, 2,3, 19,24, 2,2, 17,20, 2,2, 12,17, 1,2,  8,12, 1,1, },
{2,4, 20,27, 2,3, 19,24, 2,2, 17,20, 2,2, 12,17, 1,2,  9,12, 1,1, },
{2,4, 20,27, 2,3, 19,24, 2,2, 17,20, 2,2, 12,18, 1,2,  9,12, 1,1, },
{2,4, 20,27, 2,3, 19,24, 2,2, 17,20, 2,2, 12,18, 1,2,  9,12, 1,1, },
{2,4, 20,27, 2,3, 19,24, 2,2, 17,20, 2,2, 12,18, 1,2,  9,12, 1,1, },
{2,4, 21,27, 2,3, 20,24, 2,2, 17,20, 2,2, 13,18, 1,2,  9,12, 1,1, },
{2,4, 22,27, 2,3, 20,24, 2,3, 17,20, 2,2, 13,18, 1,2,  9,13, 1,1, },
{2,4, 22,27, 2,3, 20,25, 2,3, 17,20, 2,2, 13,19, 1,2,  9,14, 1,1, },
{2,4, 22,27, 2,3, 20,25, 2,3, 17,21, 2,2, 14,19, 1,2,  9,15, 1,1, },
{2,4, 22,27, 2,3, 20,26, 2,3, 17,21, 2,2, 15,19, 1,2,  9,15, 1,1, },
{2,4, 22,27, 2,3, 20,26, 2,3, 18,21, 2,2, 15,20, 1,2, 10,15, 1,1, },
{2,4, 22,28, 2,3, 20,26, 2,3, 18,21, 2,2, 15,20, 2,2, 10,15, 1,1, },
{2,4, 22,29, 2,3, 20,26, 2,3, 18,21, 2,2, 15,20, 2,2, 10,16, 1,1, },
{2,4, 23,29, 2,3, 20,26, 2,3, 18,21, 2,2, 15,20, 2,2, 10,16, 1,2, },
{2,4, 23,29, 2,3, 20,26, 2,3, 18,21, 2,2, 15,20, 2,2, 11,16, 1,2, },
{2,4, 23,30, 2,3, 20,27, 2,3, 18,21, 2,2, 15,20, 2,2, 11,16, 1,2, },
{2,4, 23,30, 2,3, 20,27, 2,3, 18,22, 2,2, 16,20, 2,2, 11,16, 1,2, },
{2,4, 23,30, 2,3, 20,28, 2,3, 18,22, 2,2, 16,20, 2,2, 11,16, 1,2, },
{2,4, 23,30, 2,3, 20,28, 2,3, 19,22, 2,2, 16,20, 2,2, 12,17, 1,2, },
{2,4, 23,30, 2,3, 20,28, 2,3, 19,22, 2,2, 17,20, 2,2, 12,18, 1,2, },
{2,4, 23,30, 2,3, 20,28, 2,3, 19,22, 2,2, 18,20, 2,2, 12,19, 1,2, },
{2,4, 23,30, 2,3, 20,28, 2,3, 19,22, 2,2, 18,20, 2,2, 12,19, 1,2, },
{2,4, 23,30, 2,3, 20,28, 2,3, 19,22, 2,3, 18,21, 2,2, 12,19, 1,2, },
{2,4, 23,30, 2,3, 21,28, 2,3, 19,22, 2,3, 18,21, 2,2, 12,19, 1,2, },
{2,4, 23,30, 2,3, 21,28, 2,3, 19,23, 2,3, 18,21, 2,2, 12,19, 1,2, },
{2,4, 23,30, 2,3, 21,28, 2,3, 20,23, 2,3, 18,22, 2,2, 12,19, 1,2, },
{2,4, 23,30, 2,3, 21,28, 2,3, 20,24, 2,3, 18,22, 2,2, 12,19, 1,2, },
{2,4, 23,30, 2,3, 21,28, 2,3, 20,25, 2,3, 18,22, 2,2, 12,19, 1,2, },
{2,4, 23,30, 3,3, 21,28, 2,3, 20,25, 2,3, 19,22, 2,2, 12,19, 1,2, },
{2,4, 23,30, 3,3, 21,28, 2,3, 20,25, 2,3, 19,22, 2,2, 13,19, 1,2, },
{2,4, 23,30, 3,3, 21,29, 2,3, 20,25, 2,3, 19,22, 2,2, 13,20, 1,2, },
{2,4, 23,30, 3,3, 22,30, 2,3, 21,25, 2,3, 19,22, 2,2, 13,20, 1,2, },
{2,4, 23,30, 3,3, 22,30, 3,3, 21,26, 2,3, 19,23, 2,2, 13,20, 1,2, },
{2,4, 23,30, 3,3, 22,30, 3,3, 21,27, 2,3, 19,24, 2,2, 13,20, 1,2, },
{2,4, 23,30, 3,3, 22,30, 3,3, 22,27, 2,3, 19,24, 2,3, 13,21, 1,2, },
{2,4, 24,31, 3,3, 22,30, 3,3, 22,27, 2,3, 19,25, 2,3, 13,21, 1,2, },
{3,4, 25,31, 3,3, 22,30, 3,3, 22,27, 2,3, 19,25, 2,3, 13,21, 1,2, },
{3,4, 25,31, 3,3, 22,30, 3,3, 22,27, 2,3, 19,25, 2,3, 14,21, 1,2, },
{3,4, 25,31, 3,3, 22,30, 3,3, 22,27, 2,3, 19,25, 2,3, 14,21, 1,2, },
{3,4, 25,32, 3,3, 23,30, 3,3, 23,28, 2,3, 19,25, 2,3, 14,21, 1,2, },
{3,4, 25,32, 3,3, 24,30, 3,3, 24,28, 2,3, 20,25, 2,3, 15,21, 1,2, },
{3,4, 26,32, 3,3, 24,30, 3,3, 24,28, 2,3, 20,25, 2,3, 15,21, 1,2, },
{3,4, 26,32, 3,3, 24,30, 3,3, 25,28, 2,3, 20,25, 2,3, 16,21, 1,2, },
{3,4, 26,32, 3,3, 25,30, 3,3, 25,28, 2,3, 21,25, 2,3, 16,21, 2,2, },
{3,4, 26,32, 3,3, 25,30, 3,3, 25,28, 2,3, 21,25, 2,3, 17,21, 2,2, },
{3,4, 26,32, 3,3, 25,30, 3,3, 25,28, 2,3, 21,25, 2,3, 18,21, 2,2, },
{3,4, 26,32, 3,3, 26,30, 3,3, 25,28, 2,3, 21,26, 2,3, 18,21, 2,2, },
{3,4, 26,32, 3,3, 26,30, 3,3, 25,28, 3,3, 21,26, 2,3, 19,21, 2,2, },
{3,4, 26,32, 3,3, 26,30, 3,3, 25,28, 3,3, 21,26, 2,3, 19,21, 2,2, },
{3,4, 27,32, 3,3, 26,30, 3,3, 25,29, 3,3, 21,26, 2,3, 19,21, 2,2, },
{3,4, 27,32, 3,3, 26,30, 3,3, 25,29, 3,3, 22,27, 2,3, 19,22, 2,2, },
{3,4, 27,32, 3,3, 26,30, 3,3, 25,29, 3,3, 22,27, 2,3, 19,22, 2,2, },
{3,4, 27,33, 3,3, 26,30, 3,4, 26,29, 3,3, 22,27, 2,3, 19,22, 2,2, },
{3,4, 27,33, 3,3, 26,31, 3,4, 26,29, 3,3, 23,27, 2,4, 19,22, 2,2, },
{3,5, 28,33, 3,3, 26,31, 3,4, 26,29, 3,3, 23,28, 2,4, 20,22, 2,2, },
{3,5, 28,33, 3,3, 26,32, 3,4, 26,29, 3,3, 23,28, 2,4, 20,22, 2,2, },
{3,5, 28,33, 3,3, 27,33, 3,4, 26,29, 3,3, 23,29, 2,4, 20,23, 2,3, },
{3,5, 28,34, 3,3, 27,33, 3,4, 26,29, 3,3, 24,29, 2,4, 20,23, 2,3, },
{3,5, 28,34, 3,3, 27,33, 3,4, 26,29, 3,4, 24,30, 2,4, 21,23, 2,3, },
{3,5, 29,34, 3,3, 27,33, 3,4, 26,30, 3,4, 24,30, 2,4, 21,24, 2,3, },
{3,5, 29,34, 3,3, 27,33, 3,4, 26,30, 3,4, 24,31, 2,4, 21,24, 2,3, },
{3,5, 29,34, 3,3, 27,33, 3,4, 27,31, 3,4, 24,31, 2,4, 21,24, 2,3, },
{3,5, 29,34, 3,3, 27,33, 3,4, 27,32, 3,4, 24,31, 2,4, 21,25, 2,3, },
{3,5, 29,35, 3,3, 27,34, 3,4, 27,32, 3,4, 24,31, 2,4, 21,25, 2,3, },
{3,5, 29,35, 3,3, 28,35, 3,4, 27,32, 3,4, 24,32, 2,4, 21,25, 2,3, },
{3,5, 29,35, 3,3, 28,36, 3,4, 27,32, 3,4, 24,32, 2,4, 21,26, 2,3, },
{3,5, 29,36, 3,3, 28,36, 3,4, 28,32, 3,4, 24,32, 2,4, 21,26, 2,3, },
{3,5, 30,36, 3,3, 28,36, 3,4, 28,32, 3,4, 24,32, 2,4, 21,26, 2,3, },
{3,5, 30,36, 3,4, 28,36, 3,4, 28,32, 3,4, 24,32, 2,4, 22,26, 2,3, },
{3,5, 30,36, 3,4, 28,36, 3,4, 29,32, 3,4, 25,32, 2,4, 22,26, 2,3, },
{3,5, 31,36, 3,4, 28,36, 3,4, 29,33, 3,4, 25,32, 2,4, 22,27, 2,3, },
{3,5, 31,37, 3,4, 28,37, 3,4, 29,33, 3,4, 25,33, 2,4, 22,27, 2,3, },
{3,5, 32,38, 3,4, 28,37, 3,4, 29,33, 3,4, 25,33, 3,4, 22,27, 2,3, },
{3,5, 32,39, 3,4, 28,37, 3,4, 29,33, 3,4, 26,33, 3,4, 22,27, 2,3, },
{3,5, 32,39, 3,4, 29,37, 3,4, 29,33, 3,4, 27,33, 3,4, 22,27, 2,3, },
{3,5, 32,39, 3,4, 29,37, 3,4, 30,33, 3,4, 28,33, 3,4, 22,28, 2,3, },
{3,5, 33,39, 3,4, 29,37, 3,4, 30,33, 3,4, 28,33, 3,4, 23,28, 2,3, },
{3,5, 33,40, 3,4, 29,37, 3,4, 30,33, 3,4, 28,33, 3,4, 23,28, 2,3, },
{3,5, 33,40, 3,4, 29,37, 3,4, 30,33, 3,4, 28,33, 3,4, 23,28, 2,3, },
{3,5, 34,40, 3,4, 30,37, 3,4, 30,34, 3,4, 29,33, 3,4, 23,28, 2,3, },
{3,5, 34,40, 3,4, 30,37, 3,4, 30,34, 3,4, 29,33, 3,4, 24,29, 2,3, },
{3,5, 34,41, 3,4, 30,37, 3,4, 31,34, 3,4, 29,34, 3,4, 24,29, 2,3, },
{3,5, 34,41, 3,4, 30,37, 3,4, 31,34, 3,4, 29,34, 3,4, 24,29, 2,3, },
{3,5, 35,41, 3,4, 30,37, 3,4, 31,34, 3,4, 29,34, 3,4, 24,29, 2,3, },
{3,5, 35,41, 3,4, 30,37, 3,4, 31,35, 3,4, 29,34, 3,4, 24,29, 2,3, },
{3,5, 35,41, 3,4, 31,38, 3,4, 31,35, 3,4, 29,34, 3,4, 24,29, 2,3, },
{3,5, 35,42, 3,4, 31,38, 3,4, 31,35, 3,4, 30,34, 3,4, 24,29, 2,3, },
{3,5, 36,42, 3,4, 31,38, 3,4, 31,36, 3,4, 30,34, 3,4, 24,29, 2,3, },
{3,5, 36,42, 3,4, 31,38, 3,4, 31,36, 3,4, 30,34, 3,4, 24,29, 2,3, },
{3,5, 36,42, 3,4, 31,39, 3,4, 31,36, 3,4, 30,34, 3,4, 24,29, 2,3, },
{3,5, 37,43, 3,4, 32,39, 3,4, 31,36, 3,4, 30,34, 3,4, 24,30, 3,3, },
{3,5, 37,43, 3,4, 32,39, 3,4, 32,36, 3,4, 30,35, 3,4, 25,30, 3,3, },
{3,5, 38,43, 3,4, 32,39, 3,4, 32,36, 3,4, 30,35, 3,4, 25,30, 3,3, },
{3,5, 38,43, 3,4, 32,39, 3,4, 32,37, 3,4, 30,35, 3,4, 25,30, 3,3, },
{3,5, 38,44, 3,4, 33,39, 3,4, 32,37, 3,4, 31,35, 3,4, 26,30, 3,3, },
{3,5, 38,44, 3,4, 33,39, 3,4, 33,37, 3,4, 31,35, 3,4, 27,30, 3,3, },
{3,5, 38,44, 3,4, 34,39, 3,4, 33,37, 3,4, 31,35, 3,4, 27,30, 3,3, },
{3,5, 38,44, 3,4, 34,40, 3,4, 33,37, 3,4, 31,35, 3,4, 28,30, 3,3, },
{3,5, 39,44, 3,4, 34,40, 3,4, 33,37, 3,4, 31,35, 3,4, 28,30, 3,3, },
{3,5, 39,44, 3,4, 34,40, 3,4, 33,38, 3,4, 31,35, 3,4, 28,30, 3,3, },
{3,5, 40,44, 3,4, 34,40, 3,4, 34,38, 3,4, 31,35, 3,4, 28,30, 3,3, },
{4,5, 40,45, 3,4, 34,40, 3,4, 34,38, 3,4, 32,35, 3,4, 28,30, 3,3, },
{4,5, 41,46, 3,4, 35,40, 3,4, 35,38, 3,4, 32,35, 3,4, 28,30, 3,3, },
};

int n10000;
char events[10010];
int asale[10010];
int akoma[10010];
int abonus[10010];

struct N{
	char n[11]={0};
	char & operator[](int i){ return n[i]; }
};

bool operator<(N const & a, N const & b){
	return memcmp(a.n,b.n,11)<0;
}

struct Solver {
	char const * acts=0;
	int acti=0;
	bool final=false;
	char history[200];
	
	cookie_t cookie=0;
	cookie_t speed=0;
	cookie_t refundsum=0;
	cookie_t eval=0;
	N n;
	int nsum=0;
	int nowsale=0;
	int nowfever=0;
	int turn=0;

	void output(char const * cmd, char const * arg=0){
		if(arg){
			dprintf(1,"%s %s\n",cmd,arg);
		}else{
			dprintf(1,"%s\n",cmd);
		}
	}

	bool runto(int to){
		assert(to<=n10000);
		assert(turn<=to);
		cookie_t speedall=speed+(cookie_t(1)<<n[0]);
		for(bool b=true;b;){
			int d=abonus[turn+1]+1;
			if(d>to-turn){
				d=to-turn;
				b=false;
			}
			cookie+=(akoma[turn]-akoma[turn+d])*speedall;
			turn+=d;
			if(b){
				cookie+=(cookie+99)/100;

			}
		}
		assert(turn==to);
	}
	
	bool step(int a){
		assert(a>=0&&a<11);
		bool finished=false;
		char const * cmd;
		char const * arg;
		cookie_t price1,price2,refund,delta;
		price1=pricess[a][n[a]];
		if(a==0){
			// enhclick
			refund=0;
			delta=cookie_t(1)<<n[0];
			cmd="enhclick";
			arg=0;
		}else{
			int i=a-1>>1;
			if(a&1){
				// buy
				refund=(price1+3)/4;
				delta=bspeeds[i]<<n[a+1];
				cmd="buy";
			}else{
				// reinforce
				refund=0;
				delta=bspeeds[i]*n[a-1]<<n[a];
				cmd="reinforce";
			}
			arg=fnames[i];
		}
		price2=price1-price1/10;

		cookie_t speedall=speed+(cookie_t(1)<<n[0]);
		int needkoma1=price1<=cookie?0:(price1-cookie+speedall-1)/speedall;
		int buyturn1=turn+needkoma1;
		if(buyturn1>=n10000){
			buyturn1=n10000-1;
		}
		if(akoma[turn]-akoma[buyturn1]-needkoma1>0){
			buyturn1-=(akoma[turn]-akoma[buyturn1]-needkoma1)*20;
			if(buyturn1<turn){
				buyturn1=turn;
			}
		}
		while(buyturn1<n10000 && akoma[turn]-akoma[buyturn1]<needkoma1){
			buyturn1+=1;
		}
		cookie_t gain1=-1;
		if(buyturn1<n10000){
			gain1=akoma[buyturn1]*delta+refund-price1;
		}
		
		int needkoma2=price2<=cookie?0:(price2-cookie+speedall-1)/speedall;
		int buyturn2=turn+needkoma2;
		if(buyturn2>=n10000){
			buyturn2=n10000-1;
		}
		if(akoma[turn]-akoma[buyturn2]-needkoma2>0){
			buyturn2-=(akoma[turn]-akoma[buyturn2]-needkoma2)*20;
			if(buyturn2<turn){
				buyturn2=turn;
			}
		}
		while(buyturn2<n10000 && akoma[turn]-akoma[buyturn2]<needkoma2){
			buyturn2+=1;
		}
		buyturn2+=asale[buyturn2];
		cookie_t gain2=-1;
		if(buyturn2<n10000){
			gain2=akoma[buyturn2]*delta+refund-price2;
		}

		if(gain1<0 && gain2<0){
			if(final){
				for(int i=turn;i<n10000-nsum;++i){
					output("click");
				}
			}
			runto(n10000-nsum);
			for(int i=0;i<5;){
				if(n[i*2+1]){
					n[i*2+1]-=1;
					cookie_t r=(pricess[i*2+1][n[i*2+1]]+3)/4;
					cookie+=r;
					refundsum-=r;
					speed-=bspeeds[i]<<n[i*2+2];
					if(final){
						output("sell",fnames[i]);
					}
					cookie+=(akoma[turn]-akoma[turn+1])*speed;
					if(events[turn]=='B'){
						cookie+=(cookie+99)/100;
					}
					turn+=1;
				}else{
					++i;
				}
			}
			assert(refundsum==0);
			assert(turn==n10000);
			eval=cookie;
			finished=true;
		}else{
			//ny factor
			int to=gain1>=gain2?buyturn1:buyturn2;
			if(final){
				for(int i=turn;i<to;++i){
					output("click");
				}
				output(cmd,arg);
			}
			runto(to);
			cookie-=events[turn-1]=='S'?price2:price1;
			assert(cookie>=0);
			n[a]+=1;
			if(a){
				nsum+=a&1;
				speed+=delta;
				refundsum+=refund;
			}

			cookie+=(akoma[turn]-akoma[turn+1])*speed;
			if(events[turn]=='B'){
				cookie+=(cookie+99)/100;
			}
			turn+=1;
			eval=cookie+refundsum+akoma[turn]*(speed+(cookie_t(1)<<n[0]));
		}
		return finished;
	}
	
	void run(char const * acts) {
		while(!step(*acts++)){
		}
	}

};

void init(){
	for(int a=0;a<11;++a){
		cookie_t c;
		pricess[a][0]=c=a==0?15:a&1?bprices[a>>1]:pricess[a-1][0]*10;
		for(int j=1;j<64;++j){
			pricess[a][j]=c=a&1?c+(c+4)/5:c*10;
		}
	}

	scanf("%d ",&n10000);
	gets(events);

	int koma=0;
	int fever=0;
	int nextsale=n10000*2;
	int nextbonus=n10000*2;
	for(int turn=n10000;turn--;){
		if(events[turn]=='S'){
			nextsale=turn+1;
		}
		asale[turn]=nextsale-turn;
		if(events[turn]=='B'){
			nextbonus=turn;
		}
		abonus[turn]=nextbonus-turn;
		koma+=events[turn]=='F'?121:1;
	}
	for(int turn=0;turn<n10000;++turn){
		akoma[turn]=koma;
		koma-=fever?(--fever,7):1;
		if(events[turn]=='F'){
			fever=20;
		}
	}
}

cookie_t simulate(char * best_acts){
	std::map<N,Solver> map0,map1;

	{
		Solver s;
		map0[s.n]=s;
	}

	cookie_t best_cookie=0;
	Solver best_s;
	int acti=0;
	while(!map0.empty()){
		for(auto x:map0){
			assert(x.second.eval<19000000000ll);
			for(int a=0;a<11;++a){
				Solver s=x.second;
				bool ok=true;
				s.n[a]+=1;
				for(int b=0;b<11;++b){
					if(s.n[b]<range[acti][b*2]||s.n[b]>range[acti][b*2+1]){
						ok=false;
						break;
					}
				}
				if(!s.n[1]&&s.n[2])ok=false;
				if(!s.n[3]&&s.n[4])ok=false;
				if(!s.n[5]&&s.n[6])ok=false;
				if(!s.n[7]&&s.n[8])ok=false;
				if(!s.n[9]&&s.n[10])ok=false;
				s.n[a]-=1;
				if(ok){
					s.history[acti]=a;
					if(!s.step(a)){
						auto it=map1.find(s.n);
						if(it==map1.end() || it->second.eval<s.eval){
							map1[s.n]=s;
						}
					}else{
						assert(s.turn==n10000);
						if(best_cookie<s.cookie){
							best_cookie=s.cookie;
							memcpy(best_acts,s.history,200);
						}
					}
				}
			}
		}
		++acti;
		map0=std::move(map1);
		map1.clear();
	}
	return best_cookie;
}

int main(){
	init();
	close(0);

	char best_acts[200];
	simulate(best_acts);

	{
		Solver s;
		s.final=true;
		s.run(best_acts);
	}
	return 0;
}
0