結果
問題 | No.5003 物理好きクリッカー |
ユーザー | tails |
提出日時 | 2018-12-08 03:21:59 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 70 ms / 10,000 ms |
コード長 | 14,405 bytes |
コンパイル時間 | 479 ms |
実行使用メモリ | 21,984 KB |
スコア | 317,761,005,802 |
平均クエリ数 | 10000.00 |
最終ジャッジ日時 | 2021-07-19 09:08:29 |
合計ジャッジ時間 | 5,077 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge15 |
純コード判定しない問題か言語 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 65 ms
21,912 KB |
testcase_01 | AC | 68 ms
21,852 KB |
testcase_02 | AC | 65 ms
21,672 KB |
testcase_03 | AC | 64 ms
21,864 KB |
testcase_04 | AC | 67 ms
21,372 KB |
testcase_05 | AC | 65 ms
21,408 KB |
testcase_06 | AC | 68 ms
21,528 KB |
testcase_07 | AC | 65 ms
21,336 KB |
testcase_08 | AC | 69 ms
21,840 KB |
testcase_09 | AC | 68 ms
21,876 KB |
testcase_10 | AC | 67 ms
21,864 KB |
testcase_11 | AC | 68 ms
21,516 KB |
testcase_12 | AC | 66 ms
21,432 KB |
testcase_13 | AC | 63 ms
21,372 KB |
testcase_14 | AC | 64 ms
21,864 KB |
testcase_15 | AC | 66 ms
21,840 KB |
testcase_16 | AC | 69 ms
21,840 KB |
testcase_17 | AC | 68 ms
21,864 KB |
testcase_18 | AC | 67 ms
21,528 KB |
testcase_19 | AC | 64 ms
21,876 KB |
testcase_20 | AC | 64 ms
21,360 KB |
testcase_21 | AC | 66 ms
21,504 KB |
testcase_22 | AC | 65 ms
21,516 KB |
testcase_23 | AC | 69 ms
21,516 KB |
testcase_24 | AC | 68 ms
21,684 KB |
testcase_25 | AC | 64 ms
21,828 KB |
testcase_26 | AC | 70 ms
21,864 KB |
testcase_27 | AC | 69 ms
21,360 KB |
testcase_28 | AC | 68 ms
21,504 KB |
testcase_29 | AC | 69 ms
21,504 KB |
testcase_30 | AC | 68 ms
21,864 KB |
testcase_31 | AC | 70 ms
21,492 KB |
コンパイルメッセージ
main.cpp: In function ‘void init()’: main.cpp:231:10: warning: ‘char* gets(char*)’ is deprecated [-Wdeprecated-declarations] gets(buf); ^ In file included from main.cpp:1: /usr/include/stdio.h:583:14: note: declared here extern char *gets (char *__s) __wur __attribute_deprecated__; ^~~~ main.cpp:231:10: warning: ‘char* gets(char*)’ is deprecated [-Wdeprecated-declarations] gets(buf); ^ In file included from main.cpp:1: /usr/include/stdio.h:583:14: note: declared here extern char *gets (char *__s) __wur __attribute_deprecated__; ^~~~ main.cpp:232:13: warning: ‘char* gets(char*)’ is deprecated [-Wdeprecated-declarations] gets(events); ^ In file included from main.cpp:1: /usr/include/stdio.h:583:14: note: declared here extern char *gets (char *__s) __wur __attribute_deprecated__; ^~~~ main.cpp:232:13: warning: ‘char* gets(char*)’ is deprecated [-Wdeprecated-declarations] gets(events); ^ In file included from main.cpp:1: /usr/include/stdio.h:583:14: note: declared here extern char *gets (char *__s) __wur __attribute_deprecated__; ^~~~ /tmp/ccKJLPRy.o: In function `init()': main.cpp:(.text+0x6a): warning: the `gets' function is dangerous and should not be used.
ソースコード
#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 */ "AABBBBBBDCBBDBDBDADDEDFDFBFDFDBFCBBFGFFBHHDBBB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HJJFHFDBFHDKJBFJJJDHFBJCBBBBDHFBJDHFEDDDDBJBBBBB", /* 46 */ "AABBBBBCBDBBDDDBBDBDAEDFDFDFDBBDFFFFGFFBBBBHCFBBBHDFHHHFHIDHJHHJDDBBJEFHDDJJFGFHFJDKJJJFHFDHIHHHHJJFFCDDDBBBBAJHJKJJEHJJJFFDBHFGFDFHFFDDBBJJHHHIHJHHFDDBFKJBFJJJDHFBJCBBBBDHFBJDHFEDDDDBFHJDFBBBDDHHJBFB", /* 47 */ "AABBBBBCBBBDBDDBDADDEDDFFFDDBFBBFBBFGBFHFCHDFHBBFDDBHHHIHHDBHFJEDHJDHJFFDDGJJHFJBJKJFFJJFHFHDDBBIDBDHHFBBHBCJAJFHBJHJDJKFEJFJJHHJHGFFFFFFDDDDDDBBJIHHHHJHFJHBBFDBFHDKJBFJJJDHFBJCBBBBDHFBJDHFEDDDDBBBDFB", /* 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; }