結果

問題 No.5003 物理好きクリッカー
ユーザー UMRgurashiUMRgurashi
提出日時 2022-06-03 12:18:18
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 317 ms / 10,000 ms
コード長 7,984 bytes
コンパイル時間 4,777 ms
実行使用メモリ 22,692 KB
スコア 2,426,661
平均クエリ数 10000.00
最終ジャッジ日時 2022-06-03 12:18:35
合計ジャッジ時間 17,061 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
純コード判定しない問題か言語
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 290 ms
21,744 KB
testcase_01 AC 317 ms
21,880 KB
testcase_02 AC 291 ms
21,992 KB
testcase_03 AC 294 ms
21,952 KB
testcase_04 AC 290 ms
22,692 KB
testcase_05 AC 289 ms
21,880 KB
testcase_06 AC 316 ms
21,868 KB
testcase_07 AC 289 ms
21,756 KB
testcase_08 AC 290 ms
22,264 KB
testcase_09 AC 289 ms
21,768 KB
testcase_10 AC 291 ms
22,252 KB
testcase_11 AC 305 ms
22,692 KB
testcase_12 AC 288 ms
22,680 KB
testcase_13 AC 289 ms
21,880 KB
testcase_14 AC 289 ms
21,928 KB
testcase_15 AC 291 ms
21,992 KB
testcase_16 AC 307 ms
21,880 KB
testcase_17 AC 287 ms
22,552 KB
testcase_18 AC 285 ms
21,880 KB
testcase_19 AC 286 ms
22,004 KB
testcase_20 AC 290 ms
21,880 KB
testcase_21 AC 309 ms
21,892 KB
testcase_22 AC 294 ms
21,928 KB
testcase_23 AC 290 ms
21,892 KB
testcase_24 AC 290 ms
22,420 KB
testcase_25 AC 288 ms
21,880 KB
testcase_26 AC 290 ms
21,880 KB
testcase_27 AC 293 ms
22,252 KB
testcase_28 AC 289 ms
21,868 KB
testcase_29 AC 284 ms
21,892 KB
testcase_30 AC 291 ms
21,940 KB
testcase_31 AC 289 ms
21,868 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <cstdlib>
#include <atcoder/all>
using namespace atcoder;
//#pragma GCC target ("avx2")
//#pragma GCC optimization("O3")
//#pragma GCC optimization("unroll-loops")
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define int long long
#define double long double
#define stoi stoll
#define endl "\n"
using std::abs;

using namespace std;

constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
using mint = modint1000000007;
//using mint = modint998244353;

constexpr double PI = 3.14159265358979323846;
const  int INF = 1LL << 62;

#define rep(i,n) for(int i=0;i<n;++i)
#define REP(i,n) for(int i=1;i<=n;i++)
#define krep(i,k,n) for(int i=(k);i<n+k;i++)
#define Krep(i,k,n) for(int i=(k);i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define Rrep(i,n) for(int i=n;i>0;i--)
#define LAST(x) x[x.size()-1]
#define ALL(x) (x).begin(),(x).end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x)
#define RUD(a,b) (((a)+(b)-1)/(b))
#define sum1_n(n) ((n)*(n+1)/2)
#define SUM1n2(n) (n*(2*n+1)*(n+1))/6
#define SUMkn(k,n) (SUM1n(n)-SUM1n(k-1))
#define SZ(x) ((int)(x).size())
#define PB push_back
#define Fi first
#define Se second

typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<vvint> vvvint;

typedef vector<double> vdouble;
typedef vector<vdouble> vvdouble;
typedef vector<vvdouble> vvvdouble;

typedef vector<string> vstring;

typedef vector<bool> vbool;
typedef vector<vbool> vvbool;
typedef vector<vvbool> vvvbool;

typedef map<int, int> mapint;
typedef pair<int, int> pint;
typedef pair<string, string> pstring;
typedef pair<vstring,vstring> pvstring;
typedef tuple<int, int, int>tint;

typedef vector<pint> vpint;
typedef vector<vpint> vvpint;

typedef vector<tint> vtint;
typedef vector<vtint> vvtint;


int GCD(int a, int b) {
	if (b == 0) return a;
	return GCD(b, a % b);
}
int LCM(int a, int b) {
	return  a / GCD(a, b) * b;
}

double LOG(int a, int b) {
	return log(b) / log(a);
}
double DISTANCE(int x1, int y1, int x2, int y2) {
	return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}

inline bool BETWEEN(int x, int min, int max) {
	if (min <= x && x <= max)
		return true;
	else
		return false;
}
inline bool between(int x, int min, int max) {
	if (min < x && x < max) return true;
	else return false;
}
inline bool BETWEEN2(int i,int j,int H,int W) {
	if (BETWEEN(i,0,H-1)&&BETWEEN(j,0,W-1)) return true;
	else return false;
}
template<class T>
inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T>
inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

inline bool bit(int x, int i) {
	return x >> i & 1;
}

int in() { int x; cin >> x; return x; }
string ins() { string x; cin >> x; return x; }


/*
const int MAXR = 210000;
int fac[MAXR], finv[MAXR], inv[MAXR];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAXR; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

int nCr(int n, int k) {
	if (n < k)
		return 0;
	if (n < 0 || k < 0)
		return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
*/



mint nCrm(long long N, long long K) {
	mint res = 1;
	if (N < K)
		return 0;
	if (N < 0 || K < 0)
		return 0;
	for (long long n = 0; n < K; ++n) {
		res *= (N - n);
		res /= (n + 1);
	}
	return res;
}

int nCr2(int n, int k) {
	//MODらない奴
	if (n < k)
		return 0;
	if (n < 0 || k < 0)
		return 1;
	int ans = 1;
	REP(i, k) {
		ans *= n--;
		ans /= i;
	}
	return ans;
}

vpint prime_factorize(int N) {
	vpint  res;
	for (int i = 2; i * i <= N; i++) {
		if (N % i != 0) continue;
		int ex = 0;
		while (N % i == 0) {
			++ex;
			N /= i;
		}
		res.push_back({ i, ex });
	}
	if (N != 1) res.push_back({ N, 1 });
	return res;
}

int ipow(int x, int n) {
	int ans = 1;
	while (n > 0) {
		if (n & 1) ans *= x;
		x *= x;
		n >>= 1;
	}
	return ans;
}


string base_to_k(int n, int k) {
	//n(10)→n(k)
	string ans = "";
	while (n) {
		ans += to_string(n % k);
		n /= k;
	}
	reverse(ALL(ans));
	return ans;
}


string base(string n, int k, int l) {
	//n(k)→n(l)
	return n;
}


string base_from_k(string n, int k) {
	//n(k)→n(10)
	int ans = 0;
	int N = n.size();
	rep(i, N)
		ans += (n[N - 1 - i] - '0') * ipow(k, i);
	return to_string(ans);
}

template <typename T>
vector<T> compress(vector<T>& X) {
	vector<T> vals = X;
	sort(ALL(vals));
	vals.erase(unique(ALL(vals)), vals.end());
	rep(i, SZ(X))
		X[i] = lower_bound(ALL(vals), X[i]) - vals.begin();
	return vals;
}


vector<pair<char,int>> run_length(string x) {
	vector<pair<char,int>> ans;
	
	char ch = x[0];
	int cou = 1;
REP(i, SZ(x)) {
	if (x[i] == x[i - 1]) {
		cou++;
	}
	else {
		ans.push_back({ ch,cou });
		ch = x[i];
		cou = 1;
	}
}
return ans;
}

void  yn(bool x) {
	if (x) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}
void  YN(bool x) {
	if (x) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
}

vbool prime_table(int n) {
	vbool prime(n + 1, true);
	if (n >= 0) prime[0] = false;
	if (n >= 1) prime[1] = false;
	for (int i = 2; i * i <= n; i++) {
		if (!prime[i]) continue;
		for (int j = i + i; j <= n; j += i) {
			prime[j] = false;
		}
	}
	return prime;
}

vint divisors(int N) {
	vint ans;
	for (int i = 1; i * i <= N; i++) {
		if (N % i == 0) {
			ans.push_back(N / i);
			if (i * i != N)ans.push_back(i);
		}
	}
	sort(ALL(ans));
	return ans;
}

/*
/// 行列積
vvint mat_mul(vvint& a, vvint& b) {
	vvint res(SZ(a), vint(SZ(b[0])));
	rep(i, SZ(a)) rep(j, SZ(b)) rep(k, SZ(b)) {
		(res[i][j] += a[i][k] * b[k][j]) %= MOD;
	}
	return res;
}

/// 行列累乗
vvint mat_pow(vvint a,int n) {
	vvint res(a.size(), vint(a.size()));
	// 単位行列で初期化
	rep(i, SZ(a))res[i][i] = 1;
	// 繰り返し二乗法
	while (n > 0) {
		if (n & 1) res = mat_mul(a, res);
		a = mat_mul(a, a);
		n >>= 1;
	}
	return res;
}
*/

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };


typedef vector<mint> vmint;
typedef vector<vmint> vvmint;
typedef vector<vvmint> vvvmint;

int cookie = 0;
vpint v;
vvint lv(2, vint(6)); //{個数,lv}
vint b = { 150,2000,30000,600000,10000000 };
int n = 11;
bool act;

map<int, string> ma;

void click() {
	cout << "click" << endl;
	cookie += ipow(2, lv[1][5]);
	return;
}

void buy(int co,int n) {
	act = true;
	if (n <= 5) {
		cout << "buy ";
		cout << ma[n % 5];
		lv[0][n%5]++;
		v.push_back({ co * 6 / 5, n });
	}
	else if (n <= 9) {
		cout << "reinforce ";
		cout << ma[n % 5];
		lv[1][n%5]++;
		v.push_back({ co * 10, n });
	}
	else {
		cout << "enhclick";
		lv[1][5]++;
		v.push_back({ co * 10, n });
	}
	cookie -= co;
	cout << endl;
}

void prod() {
	rep(i, 5) {
		cookie += lv[0][i] * pow(2, lv[1][i])*b[i];
	}
}

void solve() {
	int N = in();
	string S = ins();
	v.push_back({ 150,0 });
	v.push_back({ 2000,1 });
	v.push_back({ 30000,2 });
	v.push_back({ 600000,3 });
	v.push_back({ 10000000,4 });
	v.push_back({ 150,5 });
	v.push_back({ 2000,6 });
	v.push_back({ 30000,7 });
	v.push_back({ 600000,8 });
	v.push_back({ 10000000,9});
	v.push_back({ 15,10});
	ma[0] = "hand";
	ma[1] = "lily";
	ma[2] = "factory";
	ma[3] = "casino";
	ma[4] = "grimoire";
	rep(t, N) {
		sort(ALL(v), greater<pint>());
		act = false;
		if(t<=190){
			rep(i, n) {
				int co = v[i].first;
				int ac = v[i].second;
				if (cookie >= co) {
					buy(co,ac);
					v.erase(v.begin() + i);
					break;
				}
			}
		}

		if (!act)click();
		prod();
		//cout << cookie << " ";
		cout << flush;
		string x = ins();
	}

}

signed main() {
	//ios::sync_with_stdio(false);
	//cin.tie(nullptr);
	cout << fixed << setprecision(15);
	solve();
}

//bit全探索
/*
rep(i,1LL<<N){
	rep(j,N){
		if (bit(i,j)){

		}
	}
}
*/

//素因数分解
/*
const auto& res = prime_factorize(N);
for (auto p : res) {
}
*/
0