結果
問題 | No.5003 物理好きクリッカー |
ユーザー | sinsincoscos |
提出日時 | 2018-12-05 13:48:57 |
言語 | C++11 (gcc 11.4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 3,498 bytes |
コンパイル時間 | 495 ms |
実行使用メモリ | 21,984 KB |
スコア | 0 |
平均クエリ数 | 1.00 |
最終ジャッジ日時 | 2021-07-19 08:44:25 |
合計ジャッジ時間 | 4,226 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge10 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | AC | 25 ms
21,840 KB |
testcase_04 | AC | 30 ms
21,960 KB |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
ソースコード
#include <iostream> #include <stdio.h> #include <cassert> using namespace std; typedef long long ll; typedef pair<ll,int> P; int N; int ans[10200][2] = {{0}}; ll resB[10200] = {0},resF[10200] = {0},resS[10200] = {0}; ll fac_num[6] = {0},fac_level[6] = {0},beki[21] = {1}; ll fac_price[6] = {0,150,2000,30000,600000,10000000};//逐次更新する ll fac_reinforce_price[6] = {15,1500,20000,30000,600000,100000000};//逐次更新する ll fac_gain[6] = {1,1,10,120,2000,25000}; string fac_name[6] = {"click","hand","lily","factory","casino","grimoire"}; string S,result; void show(){ for(int i=1;i<=N;i++){ if(ans[i][0]==1) cout << "click" << endl; if(ans[i][0]==2) cout << "buy " << fac_name[ans[i][1]] << endl; if(ans[i][0]==3) cout << "sell " << fac_name[ans[i][1]] << endl; if(ans[i][0]==4) cout << "reinforce " << fac_name[ans[i][1]] << endl; if(ans[i][0]==5) cout << "enhclick" << endl; if(ans[i][0]==6) cout << "nothing" << endl; cin >> result; } } ll gain_from_fac(){ ll gain = 0; for(int i=1;i<=5;i++) gain += beki[fac_level[i]]*fac_num[i]*fac_gain[i]; return gain; } void reinforce_fac(int n){ fac_level[n]++; fac_reinforce_price[n] *= 10; } void buy_fac(int n){ fac_num[n]++; fac_price[n] = (fac_price[n]*6)/5; } ll is_purchase_good(int n,int time){ return beki[fac_level[n]]*(N-time+1+(resF[time]*7))+resB[time]*(beki[fac_level[n]]+99)/100 - fac_price[n]; } ll is_reinforcement_good(int n,int time){ return beki[fac_level[n]+1]*fac_num[n]*(N-time+1+(resF[time]*7))+resB[time]*(beki[fac_level[n]+1]*fac_num[n]+99)/100 - fac_reinforce_price[n]; } ll cost_performance_buy(int n){ return fac_price[n]/fac_gain[n]; } ll cost_performance_reinforce(int n){ return fac_reinforce_price[n]/(fac_gain[n]*2*fac_num[n]); } int main(){ cin >> N >> S; fac_num[0] = 1; for(int i=1;i<=20;i++) beki[i] = 2*beki[i-1]; for(int i=N;i>=1;i--){ resB[i] = (S[i]=='B'); resB[i] += resB[i-1]; resF[i] = (S[i]=='F'); resF[i] += resF[i-1]; resS[i] = (S[i]=='S'); resS[i] += resS[i-1]; } ll money = 0; int aim = 1; for(int i=1;i<=N;i++){ ll gain = 0,loss = 0; if(aim!=-1 && aim<=10 && fac_price[aim]<=money){ ans[i][0] = 2; ans[i][1] = aim; loss = fac_price[aim]; buy_fac(aim); ll mi = 1e9; aim = -1; for(int j=1;j<=5;j++){ if(mi > cost_performance_buy(j)){ mi = cost_performance_buy(j); aim = j; } } for(int j=1;j<=5;j++){ if(fac_num[j]==0) continue; if(mi > cost_performance_reinforce(j)){ mi = cost_performance_reinforce(j); aim = j+10; } } // cerr << aim << endl; }else if(aim>=10 && fac_reinforce_price[aim-10]<=money){ aim -= 10; ans[i][0] = 4; ans[i][1] = aim; loss = fac_reinforce_price[aim]; reinforce_fac(aim); ll mi = 1e9; aim = -1; for(int j=1;j<=5;j++){ if(mi > cost_performance_buy(j)){ mi = cost_performance_buy(j); aim = j; } } for(int j=0;j<=5;j++){ if(fac_num[j]==0) continue; if(mi > cost_performance_reinforce(j)){ mi = cost_performance_reinforce(j); aim = j+10; } } }else{ ans[i][0] = 1; gain++; } gain += gain_from_fac(); if(S[i-1]=='F') gain *= 7; if(S[i-1]=='S'){loss *= 9; loss = (loss+9)/10;} money += gain-loss; if(S[i-1]=='B') money += (money+99)/100; //cerr << money << " " << aim << endl; //assert(money>=0); } for(int j=0;j<=5;j++){ cerr << fac_num[j] << " " << fac_level[j] << endl; cerr << fac_price[j] << " " << fac_reinforce_price[j] << endl; } cerr << money << endl; //show(); }