結果

問題 No.5003 物理好きクリッカー
ユーザー 👑 p-adicp-adic
提出日時 2022-08-17 02:13:28
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 326 ms / 10,000 ms
コード長 3,776 bytes
コンパイル時間 780 ms
実行使用メモリ 22,856 KB
スコア 6,659,863,424
平均クエリ数 10000.00
最終ジャッジ日時 2022-08-17 02:13:40
合計ジャッジ時間 12,173 ms
ジャッジサーバーID
(参考情報)
judge16 / judge11
純コード判定しない問題か言語
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 270 ms
22,564 KB
testcase_01 AC 282 ms
22,228 KB
testcase_02 AC 270 ms
22,432 KB
testcase_03 AC 273 ms
22,704 KB
testcase_04 AC 293 ms
22,252 KB
testcase_05 AC 270 ms
21,928 KB
testcase_06 AC 273 ms
21,588 KB
testcase_07 AC 269 ms
21,756 KB
testcase_08 AC 268 ms
22,856 KB
testcase_09 AC 267 ms
22,620 KB
testcase_10 AC 277 ms
21,768 KB
testcase_11 AC 285 ms
21,892 KB
testcase_12 AC 270 ms
21,868 KB
testcase_13 AC 326 ms
22,432 KB
testcase_14 AC 269 ms
21,928 KB
testcase_15 AC 287 ms
22,204 KB
testcase_16 AC 269 ms
21,992 KB
testcase_17 AC 268 ms
22,240 KB
testcase_18 AC 272 ms
21,904 KB
testcase_19 AC 272 ms
22,540 KB
testcase_20 AC 285 ms
22,576 KB
testcase_21 AC 271 ms
21,892 KB
testcase_22 AC 267 ms
21,904 KB
testcase_23 AC 271 ms
21,916 KB
testcase_24 AC 283 ms
22,668 KB
testcase_25 AC 272 ms
22,620 KB
testcase_26 AC 288 ms
22,264 KB
testcase_27 AC 273 ms
22,564 KB
testcase_28 AC 271 ms
22,620 KB
testcase_29 AC 286 ms
22,276 KB
testcase_30 AC 274 ms
21,880 KB
testcase_31 AC 277 ms
22,624 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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( string , S );
  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] = { "nothing" , "hand" , "lily" , "factory" , "casino" , "grimoire" , "nothing" };
  string effect[3] = { "B" , "F" , "S" };
  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;
    string Si = S.substr( t , 1 );
    if( Si == effect[0] ){
      cookie += cookie / 100 + ( cookie % 100 == 0 ? 0 : 1 );
    } else if( Si == effect[1] ){
      fever = 0;
    } else if( Si == effect[2] ){
      sale = 0;
    }
  }
  FOR_LL( t , 0 , N ){
    cout << answer[t] << endl;
    cin >> reply;
  }
  return 0;

}
0