結果
| 問題 |
No.5003 物理好きクリッカー
|
| コンテスト | |
| ユーザー |
siman
|
| 提出日時 | 2018-12-05 23:40:56 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 4,475 bytes |
| コンパイル時間 | 556 ms |
| 実行使用メモリ | 21,960 KB |
| スコア | 3,338,927 |
| 平均クエリ数 | 10000.00 |
| 最終ジャッジ日時 | 2021-07-19 08:48:56 |
| 合計ジャッジ時間 | 3,973 ms |
|
ジャッジサーバーID (参考情報) |
judge10 / judge12 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 19 WA * 13 |
ソースコード
#include <cassert>
#include <cmath>
#include <iostream>
#include <vector>
#include <string.h>
using namespace std;
const int N = 10000;
const int NOTHING = -1;
const int CLICK = 0;
const int BUY = 1;
const int SELL = 2;
const int REINFORCE = 3;
const int ENHCLICK = 4;
const int HAND = 1;
const int LILY = 2;
const int FACTORY = 3;
const int CASINO = 4;
const int GRIMOIRE = 5;
const int PRODUCTIVITY[6] = {1, 1, 10, 120, 2000, 25000};
const int UPDATE_COST[6][6] = {
{
15,
150,
1500,
15000,
150000,
1500000
},
{
15,
150,
1500,
15000,
150000,
1500000
},
{
15,
150,
1500,
15000,
150000,
1500000
},
{
15,
150,
1500,
15000,
150000,
1500000
},
{
15,
150,
1500,
15000,
150000,
1500000
},
{
15,
150,
1500,
15000,
150000,
1500000
},
};
int operations[N];
class CookieClicker {
public:
void init() {
memset(operations, CLICK, sizeof(operations));
}
vector <string> run(string events) {
init();
vector<int> actions;
actions.push_back(ENHCLICK);
actions.push_back(ENHCLICK);
actions.push_back(ENHCLICK);
actions.push_back(ENHCLICK);
actions.push_back(ENHCLICK);
updateAnswer(actions);
vector <string> answer = createAnswer();
int score = calcScore();
// printf("Score = %d\n", score);
return answer;
}
vector <string> createAnswer() {
vector <string> answer;
for (int i = 0; i < N; i++) {
switch (operations[i]) {
case NOTHING:
answer.push_back("nothing");
break;
case CLICK:
answer.push_back("click");
break;
case BUY:
answer.push_back("buy");
break;
case SELL:
break;
case REINFORCE:
break;
case ENHCLICK:
answer.push_back("enhclick");
break;
default:
assert(false);
}
}
return answer;
}
void updateAnswer(vector<int> actions) {
int index = 0;
int clickLevel = 0;
int factoryLevel = 0;
int cookie = 0;
int productivity = 0;
int clickPower = 1;
for (int i = 0; i < N; i++) {
if (actions.size() <= index) break;
switch (actions[index]) {
case ENHCLICK:
if (cookie >= UPDATE_COST[CLICK][clickLevel]) {
cookie -= UPDATE_COST[CLICK][clickLevel];
clickLevel++;
clickPower *= 2;
operations[i] = ENHCLICK;
index++;
continue;
}
break;
}
cookie += productivity + clickPower;
}
}
int calcScore() {
int score = 0;
int clickPower = 1;
int clickLevel = 0;
for (int i = 0; i < N; i++) {
switch (operations[i]) {
case NOTHING:
break;
case CLICK:
score += clickPower;
break;
case ENHCLICK:
score -= UPDATE_COST[CLICK][clickLevel];
clickPower *= 2;
clickLevel++;
break;
}
// fprintf(stderr, "%d: cookie = %d\n", i, score);
}
return score;
}
};
int main() {
int n;
string s;
CookieClicker cc;
cin >> n;
cin >> s;
vector <string> answer = cc.run(s);
for (int i = 0; i < N; i++) {
cout << answer[i] << endl;
}
return 0;
}
siman