結果
問題 | No.5003 物理好きクリッカー |
ユーザー | 👑 p-adic |
提出日時 | 2022-08-17 01:26:43 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 3,779 bytes |
コンパイル時間 | 824 ms |
実行使用メモリ | 41,472 KB |
スコア | 0 |
最終ジャッジ日時 | 2022-08-17 01:27:07 |
合計ジャッジ時間 | 23,731 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | TLE | - |
testcase_01 | -- | - |
testcase_02 | -- | - |
testcase_03 | -- | - |
testcase_04 | -- | - |
testcase_05 | -- | - |
testcase_06 | -- | - |
testcase_07 | -- | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_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( 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] = { "hand" , "lily" , "factory" , "casino" , "grimoire" }; 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"; } cin >> reply; 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 << flush; cin >> reply; } return 0; }