結果

問題 No.5003 物理好きクリッカー
ユーザー tails
提出日時 2018-12-08 03:21:59
言語 C++11
(gcc 4.8.5)
結果
AC  
実行時間 150 ms
コード長 14,405 Byte
コンパイル時間 269 ms
使用メモリ 16,144 KB
スコア 317,761,005,802
平均クエリ数 10000.00
最終ジャッジ日時 2018-12-08 03:22:08

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
gen_case1.txt AC 126 ms
14,088 KB
gen_case2.txt AC 127 ms
14,076 KB
gen_case3.txt AC 130 ms
14,088 KB
gen_case4.txt AC 129 ms
14,092 KB
gen_case5.txt AC 133 ms
14,096 KB
gen_case6.txt AC 130 ms
16,132 KB
gen_case7.txt AC 135 ms
14,080 KB
gen_case8.txt AC 131 ms
14,096 KB
gen_case9.txt AC 132 ms
14,084 KB
gen_case10.txt AC 129 ms
14,084 KB
gen_case11.txt AC 134 ms
16,144 KB
gen_case12.txt AC 150 ms
14,084 KB
gen_case13.txt AC 129 ms
14,088 KB
gen_case14.txt AC 127 ms
14,084 KB
gen_case15.txt AC 129 ms
14,084 KB
gen_case16.txt AC 132 ms
16,132 KB
gen_case17.txt AC 129 ms
14,088 KB
gen_case18.txt AC 129 ms
16,124 KB
gen_case19.txt AC 129 ms
14,084 KB
gen_case20.txt AC 135 ms
14,084 KB
gen_case21.txt AC 148 ms
14,084 KB
gen_case22.txt AC 125 ms
14,092 KB
gen_case23.txt AC 129 ms
14,088 KB
gen_case24.txt AC 128 ms
14,088 KB
gen_case25.txt AC 129 ms
14,088 KB
gen_case26.txt AC 124 ms
14,088 KB
gen_case27.txt AC 132 ms
14,084 KB
gen_case28.txt AC 128 ms
14,092 KB
gen_case29.txt AC 143 ms
14,088 KB
gen_case30.txt AC 141 ms
14,092 KB
gen_case31.txt AC 129 ms
14,084 KB
gen_case32.txt AC 131 ms
14,084 KB
テストケース一括ダウンロード
コンパイルメッセージ
main.cpp: In function ‘void init()’:
main.cpp:231:2: warning: ‘char* gets(char*)’ is deprecated (declared at /usr/include/stdio.h:638) [-Wdeprecated-declarations]
  gets(buf);
  ^
main.cpp:231:10: warning: ‘char* gets(char*)’ is deprecated (declared at /usr/include/stdio.h:638) [-Wdeprecated-declarations]
  gets(buf);
          ^
main.cpp:232:2: warning: ‘char* gets(char*)’ is deprecated (declared at /usr/include/stdio.h:638) [-Wdeprecated-declarations]
  gets(events);
  ^
main.cpp:232:13: warning: ‘char* gets(char*)’ is deprecated (declared at /usr/include/stdio.h:638) [-Wdeprecated-declarations]
  gets(events);
             ^
/tmp/ccWnsAId.o: In function `init()':
main.cpp:(.text+0x7a): warning: the `gets' function is dangerous and should not be used.

ソースコード

diff #
#include <stdio.h>
#include <unistd.h>

typedef long long cookie_t;

char const fnames[][16]={"hand","lily","factory","casino","grimoire"};
cookie_t const bspeeds[]={1,10,120,2000,25000};
cookie_t const bprices[]={150,2000,30000,600000,10000000};

char const * const actss[]={
/* 00 */ "AABBBBBBCBBDDBDDDBDAEDDFDFFFBDBBFFGFFCBBHBHDBHFHHHDIHHFJHJHEDJFFDDJJBDDBJKJGHFFJJFJFHDHFDBIHHJHJFHFDBBHJJJCDBBBBAKJJJJHHFEDFDDHGFFFFDDDBBJHFDIHHHJHBFJHBBFDBFHDKJBFJJJDHFBJCBBBBDHFBJDHFEDDDDBJDHFABGFFF",
/* 01 */ "AABBBBBBDCBBDBDBDADDEDFDFBFDFDBFCBBFGFFBHHDBBBFFBDBHHHHDIHHJJHFJHJEDHFFDDDDBJBGJJKJFFFFHJJFDJHHIHHHBJHDJFFCDDDDBBBBBAHEFHHFFJJJJKJGFDFDJFDJDBBBJFHHHIJHHHFJHJHBBFDBFHDKJBFJJJDHFBJCBBBBDHFBJDHFEDDDDBFBD",
/* 02 */ "AABBBBBBCBBDDBBBDADDDEDDFFDBBFDDFCBBFBDBGFFFHHHBFBHBFDFHHIHHHDEDFDDDBFFBJJJFJHGJDHJKJJFFHHDBJDHHIJFFBBHHJHFHCDBBAJBBJJKJJJHFEDDJGHHFFFFFDDDDDBBJFIHHJHH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BBBBCBBBDBDDBDADDEDDFFFDDBFBBFBBFGBFHFCHDFHBBFDDBHHHIHHDBHFJEDHJDHJFFDDGJJHFJBJKJFFJJFHFHDDBBIDBDHHFBBHBCJAJFHBJHJDJKFEJFJJHHJHGFFFFFFDDDDDDBBJIHHHHJHFJHBBFDBFHDKJBFJJJDHFBJCBBBBDHFBJDHFEDDDDBBBDFB",
/* 48 */ "AABBBBBBCBBDDBDBDDADDEFDFFDDFBBFGFFBCBBFHBHBFHHDDHBHIHFHJHJEJDFDFDDDFHDBBJJKJJGFFHJJJHFFHDDBBIJHHFDFHHJHFBJJJJCDBBBBAJHHFKFJEGFFDJDHFDDBBJDFBBHJFHHIJHFHHJHBFDBFHDKJBFJJJDHFBJCBBBBDHFBJDHFEDDDFDBBHBDDD",
/* 49 */ "AABBBBBBCBDBDBDBDADBDEDFDFFDDBBFBFFGFFCBBDBHHFHDHFHDFHIHHDJHDFJJEDBHDJGFFDBFHFDJKJJJJFHFDBIHHHHJJFFCDDBBBBBBBAHFHHJJFDDDBJKJJEJHJGHFFFFFDDDDDBBBJHIHHFHJJHHJHFFHDKJBFJJJDHFBJCBBBBDHFBJDHFEDDDDBDBJHBFBB",
	0
};

char buf[100];
char events[10010];
int asale[10010];
int akoma[10010];
int abonus[10010];

cookie_t buy_price(cookie_t price,int num){
	for(;num--;){
		price+=(price+4)/5;
	}
	return price;
}

cookie_t rein_price(cookie_t price,int lvl){
	for(;lvl--;){
		price*=10;
	}
	return price;
}

struct Solver {
	char const * acts=0;
	bool final=false;
	
	cookie_t cookie=0;
	int acti=0;
	int cl=0;
	int n[5]={0,0,0,0,0};
	int l[5]={0,0,0,0,0};
	int nsum=0;
	int nowsale=0;
	int nowfever=0;
	int turn=0;

	void output(char const * cmd){
		if(final){
			dprintf(1,"%s\n",cmd);
		}
	}

	void output(char const * cmd, char const * arg){
		if(final){
			dprintf(1,"%s %s\n",cmd,arg);
		}
	}

	void estimate(cookie_t & price, cookie_t & refund, cookie_t & delta, cookie_t & saved){
		int a=acts[acti];
		if(a=='A'){
			// enhclick
			price=rein_price(15,cl);
			refund=0;
			delta=cookie_t(1)<<cl;
		}else{
			int i=a-'B'>>1;
			if(a&1){
				// reinforce
				price=rein_price(bprices[i]*10,l[i]);
				refund=0;
				delta=bspeeds[i]*n[i]<<l[i];
			}else{
				// buy
				price=buy_price(bprices[i],n[i]);
				refund=(price+3)/4;
				delta=bspeeds[i]<<l[i];
			}
		}
		saved=price/10;
		if(nowsale){
			price-=saved;
			saved=0;
		}
	}

	cookie_t estimate(){
		cookie_t price,refund,delta,saved;
		estimate(price,refund,delta,saved);
		return price;
	}

	void act_consume(){
		cookie_t price=estimate();
		cookie-=price;
		int a=acts[acti++];
		if(a=='A'){
			// enhclick
			cl+=1;
			output("enhclick");
		}else{
			int i=a-'B'>>1;
			if(a&1){
				// reinforce
				l[i]+=1;
				output("reinforce",fnames[i]);
			}else{
				// buy
				n[i]+=1;
				nsum+=1;
				output("buy",fnames[i]);
			}
		}
	}

	void act_click(){
		cookie+=(cookie_t(1)<<cl)*(nowfever?7:1);
		output("click");
	}

	void action(){
		int a=acts[acti];
		if(turn+nsum>=10000){
			for(int i=0;i<5;++i){
				if(n[i]){
					n[i]-=1;
					cookie+=(buy_price(bprices[i],n[i])+3)/4;
					output("sell",fnames[i]);
					return;
				}
			}
		}else if(a>='A'&&a<='K'){
			cookie_t price,refund,delta,saved;
			estimate(price,refund,delta,saved);
			if(cookie>=price && akoma[turn]*delta+refund>=price && asale[turn]*delta*2>=saved){
				act_consume();
				return;
			}
		}else{
			dprintf(2,"out of action\n");
		}
		act_click();
	}
	
	void step() {
		// action
		action();

		// produce
		for(int i=0;i<5;++i){
			cookie+=(bspeeds[i]*n[i]<<l[i])*(nowfever?7:1);
		}
		// event
		if(nowfever){
			--nowfever;
		}
		if(nowsale){
			--nowsale;
		}
		if(events[turn]=='F'){
			nowfever=20;
		}
		if(events[turn]=='S'){
			nowsale=1;
		}
		if(events[turn]=='B'){
			cookie+=(cookie+99)/100;
		}
	}
	
	void run() {
		for(;turn<10000;++turn){
			step();
		}
	}
	
};

void init(){
	gets(buf);
	gets(events);

	int koma=0;
	int fever=0;
	int bonus=0;
	int nextsale=20000;
	for(int turn=10000;turn--;){
		if(events[turn]=='S'){
			nextsale=turn;
		}
		asale[turn]=nextsale-turn;
		koma+=events[turn]=='F'?121:1;
		if(events[turn]=='B'){
			bonus+=1;
		}
		abonus[turn]=bonus;
	}
	for(int turn=0;turn<10000;++turn){
		akoma[turn]=koma;
		koma-=fever?(--fever,7):1;
		if(events[turn]=='F'){
			fever=20;
		}
	}
}

int main(){
	init();
	close(0);

	int best_actsi=0;
	int best_cookie=0;
	for(int actsi=0;actss[actsi];++actsi){
		Solver s;
		s.acts=actss[actsi];
		s.run();
		if(best_cookie<s.cookie){
			best_cookie=s.cookie;
			best_actsi=actsi;
		}
	}
	{
		Solver s;
		s.acts=actss[best_actsi];
		s.final=true;
		s.run();
	}
	return 0;
}

0