結果

問題 No.5003 物理好きクリッカー
ユーザー ts_ts_
提出日時 2018-12-05 17:19:17
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 323 ms / 10,000 ms
コード長 3,560 bytes
コンパイル時間 1,278 ms
実行使用メモリ 21,972 KB
スコア 178,729,114,744
平均クエリ数 10000.00
最終ジャッジ日時 2021-07-19 08:47:46
合計ジャッジ時間 13,954 ms
ジャッジサーバーID
(参考情報)
judge10 / judge12
純コード判定しない問題か言語
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 312 ms
21,300 KB
testcase_01 AC 310 ms
21,312 KB
testcase_02 AC 307 ms
21,540 KB
testcase_03 AC 308 ms
21,492 KB
testcase_04 AC 321 ms
21,516 KB
testcase_05 AC 311 ms
21,372 KB
testcase_06 AC 312 ms
21,852 KB
testcase_07 AC 310 ms
21,864 KB
testcase_08 AC 316 ms
21,828 KB
testcase_09 AC 315 ms
21,864 KB
testcase_10 AC 323 ms
21,828 KB
testcase_11 AC 311 ms
21,840 KB
testcase_12 AC 311 ms
21,504 KB
testcase_13 AC 316 ms
21,468 KB
testcase_14 AC 312 ms
21,492 KB
testcase_15 AC 311 ms
21,492 KB
testcase_16 AC 307 ms
21,840 KB
testcase_17 AC 312 ms
21,492 KB
testcase_18 AC 312 ms
21,312 KB
testcase_19 AC 313 ms
21,528 KB
testcase_20 AC 310 ms
21,312 KB
testcase_21 AC 313 ms
21,504 KB
testcase_22 AC 311 ms
21,336 KB
testcase_23 AC 314 ms
21,852 KB
testcase_24 AC 310 ms
21,684 KB
testcase_25 AC 310 ms
21,852 KB
testcase_26 AC 309 ms
21,336 KB
testcase_27 AC 311 ms
21,300 KB
testcase_28 AC 322 ms
21,816 KB
testcase_29 AC 321 ms
21,816 KB
testcase_30 AC 310 ms
21,888 KB
testcase_31 AC 317 ms
21,312 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

const int N=10000;
string S;

ll tot=0;
vector<string> mov={"click","buy","sell","reinforce","enhclick"};
vector<string> nam={"hand","lily","factory","casino","grimoire"};
ll bcost[5]={150,2000,30000,600000,10000000},rcost[6]={150,20000,300000,6000000,100000000,15};
ll base[5]={1,10,120,2000,25000};
int satu[5]={0,7,7,7,14};
int numfa[5],numref[6];
int feverend=0,pfac=1;
bool disc=false;
pint ans[N];
inline void nxphase(int turn){
	if(S[turn]=='B') tot+=(tot+99)/100;
	else if(S[turn]=='F') feverend=turn+20,pfac=7;
	else if(S[turn]=='S') disc=true;
	else disc=false;
	if(feverend==turn) pfac=1;
	return;
}
inline ll get_c(){
	ll ret=0;
	rep(i,5){
		ret+=(base[i]<<numref[i])*numfa[i];
	}
	return ret*pfac;
}
//Bが近くにあれば購入保留を考える
int nxb=0;
void init(){
	int turn=0;
	ans[turn]={0,0};++tot;++turn;
	while(numref[5]<3){
		if(tot>=rcost[5]){
			ll tcos=rcost[5];
			if(disc) tcos=(tcos*9+9)/10;
			tot-=tcos;
			rcost[5]*=10;++numref[5];
			ans[turn]={4,0};
		}
		else{
			ans[turn]={0,0};tot+=(1ll<<numref[5]);
		}
		nxphase(turn);
		++turn;
	}
	cerr<<turn<<" "<<tot<<endl;
	FOR(i,1,5){
		while(numfa[i]<satu[i]){
			if(tot>=bcost[i]){
				ll tcos=bcost[i];
				if(disc) tcos=(tcos*9+9)/10;
				tot-=tcos;
				bcost[i]=(bcost[i]*6+4)/5;++numfa[i];
				ans[turn]={1,i};
			}
			/*
			else if(numfa[i-2]>0){
				ans[turn]={2,i-2};
				tot+=(ll)(bcost[i-2]+3/4);
				--numfa[i-2];
				bcost[i-2]=(ll)((double)bcost[i-2]/1.2);//tekito-
			}
			*/
			else{
				ans[turn]={0,0};tot+=(1ll<<numref[5])*pfac;
			}
			tot+=get_c();
			nxphase(turn);
			++turn;
			if(turn==7000) break;
		}
		cerr<<turn<<" "<<tot<<endl;
		if(turn==7000) break;
	}
	int cnt=0,cur=2;
	while(turn<N){
		if(turn+3<N&&S[turn+3]=='B') nxb=turn+3;

		if(turn>nxb&&numref[4]==1&&numref[3]==0&&tot>=rcost[3]){
				ll tcos=rcost[3];
				if(disc) tcos=(tcos*9+9)/10;
				tot-=tcos;
				rcost[3]*=10;++numref[3];
				ans[turn]={3,3};
		}
			
		else if(turn>nxb&&numref[4]==2&&numref[3]==1&&tot>=rcost[3]){
			ll tcos=rcost[3];
			if(disc) tcos=(tcos*9+9)/10;
			tot-=tcos;
			rcost[3]*=10;++numref[3];
			ans[turn]={3,3};
		}
		
		else if(turn>nxb&&turn<8500&&cnt<2&&tot>=rcost[4]){
			
			ll tcos=rcost[4];
			if(disc) tcos=(tcos*9+9)/10;
			tot-=tcos;
			rcost[4]*=10;++numref[4];
			ans[turn]={3,4};
			++cnt;
			cerr<<turn<<endl;
		}
		
		else if(turn>nxb&&turn<8500&&numref[4]==2&&numfa[4]<18&&tot>=bcost[4]){
			ll tcos=bcost[4];
			if(disc) tcos=(tcos*9+9)/10;
			tot-=tcos;
			bcost[4]=(bcost[4]*6+4)/5;++numfa[4];
			ans[turn]={1,4};
		}
		else if(turn>nxb&&turn<8500&&numref[3]==2&&numfa[3]<20&&tot>=bcost[3]){
			ll tcos=bcost[3];
			if(disc) tcos=(tcos*9+9)/10;
			tot-=tcos;
			bcost[3]=(bcost[3]*6+4)/5;++numfa[3];
			ans[turn]={1,3};
		}
		else if(cur<5&&numfa[cur]>0&&(turn>=N-44)){
			ans[turn]={2,cur};
			tot+=(ll)(bcost[cur]+3)/4;
			--numfa[cur];
			bcost[cur]=(ll)((double)bcost[cur]/1.2);//tekito-
			if(numfa[cur]==0) ++cur;
		}
		else{ans[turn]={0,0};tot+=(1ll<<numref[5])*pfac;}
		tot+=get_c();
		nxphase(turn);
		++turn;
	}
	cerr<<turn<<" "<<tot<<endl;
}
int main(){
    int drop;
    cin>>drop>>S;

	init();

	cerr<<tot<<endl;
	string ds;
	rep(i,N){
		if(ans[i].first==0) cout<<"click"<<endl;
		else if(ans[i].first==4) cout<<"enhclick"<<endl;
		else{
			cout<<mov[ans[i].first]<<" "<<nam[ans[i].second]<<endl;
		}
		cin>>ds;
	}
    return 0;
}
0