結果
| 問題 |
No.5003 物理好きクリッカー
|
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2022-08-17 01:59:11 |
| 言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 3,721 bytes |
| コンパイル時間 | 848 ms |
| 実行使用メモリ | 42,592 KB |
| スコア | 0 |
| 最終ジャッジ日時 | 2022-08-17 01:59:37 |
| 合計ジャッジ時間 | 23,660 ms |
|
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | TLE * 1 -- * 31 |
ソースコード
#include <iostream>
#include <list>
#include <vector>
#include <string>
#include <stdio.h>
#include <stdint.h>
#include <iomanip>
#include <algorithm>
using namespace std;
using ll = long long;
#define CIN( LL , A ) LL A; cin >> A
#define GETLINE( A ) string A; getline( cin , A )
#define GETLINE_SEPARATE( A , SEPARATOR ) string A; getline( cin , A , SEPARATOR )
#define FOR_LL( VAR , INITIAL , FINAL_PLUS_ONE ) for( ll VAR = INITIAL ; VAR < FINAL_PLUS_ONE ; VAR ++ )
#define FOR_ITR( ARRAY , ITR , END ) for( auto ITR = ARRAY .begin() , END = ARRAY .end() ; ITR != END ; ITR ++ )
#define REPEAT( HOW_MANY_TIMES ) FOR_LL( VARIABLE_FOR_REPEAT , 0 , HOW_MANY_TIMES )
#define RETURN( ANSWER ) cout << ( ANSWER ) << endl; return 0
#define DOUBLE( PRECISION , ANSWER ) cout << fixed << setprecision( PRECISION ) << ( ANSWER ) << endl; return 0
#define MIN( A , B ) A < B ? A : B;
#define MAX( A , B ) A < B ? B : A;
int main()
{
CIN( ll , N );
CIN( char , S[10001] );
ll cookie = 200;
ll price[7] = { 0 , 150 , 2000 , 30000 , 600000 , 1000000 , 0 };
ll price_last[7] = { 0 , 0 , 0 , 0 , 0 , 0 , 0 };
ll enh[7] = { 15 , 1500 , 20000 , 300000 , 6000000 , 10000000 , 0 };
ll num[7] = { 1 , 0 , 0 , 0 , 0 , 0 , 0 };
ll click[7] = { 1 , 1 , 10 , 120 , 2000 , 25000 , -1 };
string name[7] = { "hand" , "lily" , "factory" , "casino" , "grimoire" };
char effect[4] = "BFS";
ll status = 0;
ll fever = -1;
ll sale = -1;
string answer[10000];
string reply;
FOR_LL( t , 0 , N ){
ll price_next = sale == -1 ? price[status + 1] : ( price[status + 1] * 9 ) / 10 + ( price[status + 1] % 10 == 0 ? 0 : 1 );
ll price_current = sale == -1 ? price[status] : ( price[status] * 9 ) / 10 + ( price[status] % 10 == 0 ? 0 : 1 );
ll sell_current = price_last[status] / 4 + ( price_last[status] % 4 == 0 ? 0 : 1 );
ll enh_current = sale == -1 ? enh[status] : ( enh[status] * 9 ) / 10 + ( enh[status] % 10 == 0 ? 0 : 1 );
ll rate = fever == -1 ? 1 : 7;
// 特殊効果を考慮せず2ターン分の行動しか評価しない決め打ち
if( cookie > price_next && price_next < ( N - t ) * click[status + 1] ){
status++;
cookie -= price_next;
price_last[status] = price_next;
price[status] = ( price[status] * 6 ) / 5 + ( ( price[status] * 6 ) % 5 == 0 ? 0 : 1 );
num[status]++;
answer[t] = "buy " + name[status];
} else if( cookie + sell_current > price_next && num[status] > 0 && price_next < ( N - t ) * click[status + 1] ){
cookie += sell_current;
num[status]--;
answer[t] = "sell " + name[status];
} else if( cookie > enh_current && enh_current < ( N - t ) * click[status] ){
cookie -= enh_current;
enh[status] = enh[status] * 10;
click[status] *= 2;
answer[t] = ( status == 0 ? "enhclick " : "reinforce " + name[status] );
} else if( cookie > price_current && price_current < ( N - t ) * click[status] && status > 0 ){
cookie -= price_current;
price[status] = ( price[status] * 6 ) / 5 + ( ( price[status] * 6 ) % 5 == 0 ? 0 : 1 );
num[status]++;
answer[t] = "buy " + name[status];
} else {
cookie += click[0] * rate;
answer[t] = "click";
}
FOR_LL( j , 1 , 7 ){
cookie += click[j] * num[j] * rate;
}
if( fever != -1 ){
if( fever < 19 ){
fever++;
} else {
fever = -1;
}
}
sale = -1;
if( S[t] == effect[0] ){
cookie += cookie / 100 + ( cookie % 100 == 0 ? 0 : 1 );
} else if( S[t] == effect[1] ){
fever = 0;
} else if( S[t] == effect[2] ){
sale = 0;
}
}
FOR_LL( t , 0 , N ){
cout << answer[t] << endl << flush;
cin >> reply;
}
return 0;
}