QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#31527#4004. Resource CalculatorQingyuAC ✓282ms3724kbC++237.4kb2022-05-08 21:15:432022-05-08 21:15:46

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-05-08 21:15:46]
  • 评测
  • 测评结果:AC
  • 用时:282ms
  • 内存:3724kb
  • [2022-05-08 21:15:43]
  • 提交

answer

#include <bits/stdc++.h>

const int L = 105;

int64_t to_next[L];

void load_data();

int64_t exp_to_coins(int64_t exp) {
	return exp * 0.2;
}

struct gemstones_t {
	int type; // 0, 1, 2, 3 => S, F, C, G
	int64_t amount;
	gemstones_t() = default;
	gemstones_t(int type, int64_t amount) : type(type), amount(amount) {
		assert(0 <= type && type <= 3);
	}
};
struct mob_drops_t {
	int type; // 0, 1, 2 => C, R, E
	int64_t amount;
	mob_drops_t() = default;
	mob_drops_t(int type, int64_t amount) : type(type), amount(amount) {
		assert(0 <= type && type <= 2);
	}
};
struct talent_books_t {
	int type; // 0, 1, 2 => T, G, P
	int64_t amount;
	talent_books_t() = default;
	talent_books_t(int type, int64_t amount) : type(type), amount(amount) {
		assert(0 <= type && type <= 2);
	}
};

struct asc {
	gemstones_t g;
	mob_drops_t m;
	int64_t normal_level, boss_drops, spec, coins;
	asc() {}
	asc(int64_t normal_level, gemstones_t g, int64_t boss_drops,
			mob_drops_t m, int64_t spec, int64_t coins) :
		normal_level(normal_level), g(g), boss_drops(boss_drops),
		m(m), spec(spec), coins(coins) {
			assert(20 <= normal_level <= 80);
			assert(3 <= spec && spec <= 60);

		}
} pa[10];
struct tal {
	int64_t coins, wbd, coi; // Weekly Boss Drops, Crown of Insight
	mob_drops_t m; // Mob Drops
	talent_books_t tb; // Talent Books
	tal() = default;
	tal(int64_t coins, mob_drops_t m, talent_books_t tb, int64_t wbd, int64_t coi) :
		coins(coins), m(m), tb(tb), wbd(wbd), coi(coi) {
			assert(0 <= wbd && wbd <= 2);
			assert(0 <= coi && coi <= 1);
		}
} pt[10];

int64_t a0, l0, t10, t20, t30, a, l, t1, t2, t3;
int64_t coins, local_spec, boss_drops, wbd, coi;
int64_t wa, ae, hw;
int64_t gemstones[4], mob_drops[3], talent_books[3];
// Wanderer's Advice: 1000 points
// Adventurer's Experience: 5000 points
// Hero's Wit: 20'000 points

void clear() {
	coins = local_spec = boss_drops = wbd = coi = wa = ae = hw = 0;
	memset(gemstones, 0, sizeof gemstones);
	memset(mob_drops, 0, sizeof mob_drops);
	memset(talent_books, 0, sizeof talent_books);
}

void get_experience(int64_t exp) {
	int64_t cw = 0, ca = 0, ch = 0, _exp = exp;
	ch = exp / 20'000;
	exp -= ch * 20'000;
	if (exp > 19'000) {
		++ch;
	}
	else {
		ca = exp / 5'000;
		exp -= ca * 5000;
		if (exp > 4000) {
			++ca;
		}
		else {
			cw = (exp + 999) / 1'000;
		}
	}
	int64_t gains = ch * 20'000 + ca * 5'000 + cw * 1'000;
	coins += exp_to_coins(_exp);
	wa += cw;
	ae += ca;
	hw += ch;
}

int64_t get_normal_level_requirement() {
	int64_t ret = l;
	if (a > 0) {
		ret = std::max(ret, pa[a - 1].normal_level);
	}
	return ret;
}

void upgrade_normal_level_to(int64_t target) {
	//fprintf(stderr, "l0 = %lld, target = %lld\n", l0, target);

	assert(target >= l0);
	int64_t exp_needed = 0;
	for (int j = l0; j < target; ++j) {
		exp_needed += to_next[j];
	}
	get_experience(exp_needed);
	l0 = target;
}

void upgrade_normal_level() {
	int64_t boost_to = get_normal_level_requirement();
	auto stages = { 20, 40, 50, 60, 70, 80, 90 };
	for (auto milestone : stages) {
		if (milestone > boost_to) {
			upgrade_normal_level_to(boost_to);
		}
		else if (milestone > l0) {
			upgrade_normal_level_to(milestone);
		}
	}
}

void upgrade_ascension_level() {
	for (int j = a0; j < a; ++j) {
		assert(l0 >= pa[j].normal_level);
		gemstones[pa[j].g.type] += pa[j].g.amount;
		boss_drops += pa[j].boss_drops;
		mob_drops[pa[j].m.type] += pa[j].m.amount;
		local_spec += pa[j].spec;
		coins += pa[j].coins;
	}
	a0 = a;
}

void upgrade_talent_level(int64_t &t0, const int64_t &t) {
	for (int j = t0; j < t; ++j) {
		coins += pt[j].coins;
		mob_drops[pt[j].m.type] += pt[j].m.amount;
		talent_books[pt[j].tb.type] += pt[j].tb.amount;
		wbd += pt[j].wbd;
		coi += pt[j].coi;
	}
	t0 = t;
}

void solve() {
	clear();
	// Stage 1: upgrade l0 to l
	upgrade_normal_level();
	// Stage 2: upgrade a0 to a
	upgrade_ascension_level();
	// Stage 3: upgrade t*0 to t*
	upgrade_talent_level(t10, t1);
	upgrade_talent_level(t20, t2);
	upgrade_talent_level(t30, t3);
	printf("%lld %lld %lld %lld %lld\n", 
			coins, local_spec, boss_drops,
			wbd, coi);
	printf("%lld %lld %lld\n", wa, ae, hw);
	printf("%lld %lld %lld %lld\n", 
			gemstones[0],
			gemstones[1],
			gemstones[2],
			gemstones[3]);
	printf("%lld %lld %lld\n",
			mob_drops[0],
			mob_drops[1],
			mob_drops[2]);
	printf("%lld %lld %lld\n",
			talent_books[0],
			talent_books[1],
			talent_books[2]);
}

int main() {
	load_data();
	std::ios::sync_with_stdio(false);
	std::cin.tie(nullptr);
	std::cout.tie(nullptr);
	int T;
	std::cin >> T;
	while (T--) {
		std::cin >> a0 >> l0 >> t10 >> t20 >> t30 >> a >> l >> t1 >> t2 >> t3;
		solve();
	}
	return 0;
}

void load_data() {
	pt[1] = tal(12'500, mob_drops_t(0, 6), talent_books_t(0, 3), 0, 0);
	pt[2] = tal(17'500, mob_drops_t(1, 3), talent_books_t(1, 2), 0, 0);
	pt[3] = tal(25'000, mob_drops_t(1, 4), talent_books_t(1, 4), 0, 0);
	pt[4] = tal(30'000, mob_drops_t(1, 6), talent_books_t(1, 6), 0, 0);
	pt[5] = tal(37'500, mob_drops_t(1, 9), talent_books_t(1, 9), 0, 0);
	pt[6] = tal(120'000, mob_drops_t(2, 4), talent_books_t(2, 4), 1, 0);
	pt[7] = tal(260'000, mob_drops_t(2, 6), talent_books_t(2, 6), 1, 0);
	pt[8] = tal(450'000, mob_drops_t(2, 9), talent_books_t(2, 12), 2, 0);
	pt[9] = tal(700'000, mob_drops_t(2, 12), talent_books_t(2, 16), 2, 1);
	pa[0] = asc(20, gemstones_t(0, 1), 0, mob_drops_t(0, 3), 3, 20'000);
	pa[1] = asc(40, gemstones_t(1, 3), 2, mob_drops_t(0, 15), 10, 40'000);
	pa[2] = asc(50, gemstones_t(1, 6), 4, mob_drops_t(1, 12), 20, 60'000);
	pa[3] = asc(60, gemstones_t(2, 3), 8, mob_drops_t(1, 18), 30, 80'000);
	pa[4] = asc(70, gemstones_t(2, 6), 12, mob_drops_t(2, 12), 45, 100'000);
	pa[5] = asc(80, gemstones_t(3, 6), 20, mob_drops_t(2, 24), 60, 120'000);
to_next[1]=1000;to_next[2]=1325;to_next[3]=1700;to_next[4]=2150;to_next[5]=2625;to_next[6]=3150;to_next[7]=3725;to_next[8]=4350;to_next[9]=5000;to_next[10]=5700;to_next[11]=6450;to_next[12]=7225;to_next[13]=8050;to_next[14]=8925;to_next[15]=9825;to_next[16]=10750;to_next[17]=11725;to_next[18]=12725;to_next[19]=13775;to_next[20]=14875;to_next[21]=16800;to_next[22]=18000;to_next[23]=19250;to_next[24]=20550;to_next[25]=21875;to_next[26]=23250;to_next[27]=24650;to_next[28]=26100;to_next[29]=27575;to_next[30]=29100;to_next[31]=30650;to_next[32]=32250;to_next[33]=33875;to_next[34]=35550;to_next[35]=37250;to_next[36]=38975;to_next[37]=40750;to_next[38]=42575;to_next[39]=44425;to_next[40]=46300;to_next[41]=50625;to_next[42]=52700;to_next[43]=54775;to_next[44]=56900;to_next[45]=59075;to_next[46]=61275;to_next[47]=63525;to_next[48]=65800;to_next[49]=68125;to_next[50]=70475;to_next[51]=76500;to_next[52]=79050;to_next[53]=81650;to_next[54]=84275;to_next[55]=86950;to_next[56]=89650;to_next[57]=92400;to_next[58]=95175;to_next[59]=98000;to_next[60]=100875;to_next[61]=108950;to_next[62]=112050;to_next[63]=115175;to_next[64]=118325;to_next[65]=121525;to_next[66]=124775;to_next[67]=128075;to_next[68]=131400;to_next[69]=134775;to_next[70]=138175;to_next[71]=148700;to_next[72]=152375;to_next[73]=156075;to_next[74]=159825;to_next[75]=163600;to_next[76]=167425;to_next[77]=171300;to_next[78]=175225;to_next[79]=179175;to_next[80]=183175;to_next[81]=216225;to_next[82]=243025;to_next[83]=273100;to_next[84]=306800;to_next[85]=344600;to_next[86]=386950;to_next[87]=434425;to_next[88]=487625;to_next[89]=547200;to_next[90]=1e18;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 3ms
memory: 3600kb

input:

2
0 1 1 1 1 0 20 4 5 6
0 20 3 3 3 1 30 6 6 6

output:

286535 0 0 0 0
1 0 6
0 0 0 0
18 42 0
9 39 0
340085 3 0 0 0
3 2 10
1 0 0 0
3 57 0
0 57 0

result:

ok 10 lines

Test #2:

score: 0
Accepted
time: 282ms
memory: 3724kb

input:

171037
0 1 9 8 6 0 1 10 10 10
0 1 4 5 8 0 2 7 7 9
0 1 6 8 8 0 3 8 8 9
0 1 8 2 2 0 4 10 5 8
0 1 6 4 5 0 5 7 7 9
0 1 9 9 6 0 6 9 10 7
0 1 6 4 6 0 7 6 5 9
0 1 10 9 10 0 8 10 10 10
0 1 7 10 2 0 9 9 10 5
0 1 6 8 1 0 10 7 8 6
0 1 4 6 8 0 11 10 6 10
0 1 1 6 9 0 12 10 6 10
0 1 5 5 9 0 13 7 8 9
0 1 3 1 2 0 1...

output:

3380000 0 0 12 3
0 0 0
0 0 0 0
0 0 64
0 0 82
795200 0 0 4 0
1 0 0
0 0 0 0
0 24 17
0 24 20
830465 0 0 4 0
3 0 0
0 0 0 0
0 0 19
0 0 22
1713305 0 0 6 1
0 1 0
0 0 0 0
0 35 31
0 33 38
1176235 0 0 6 0
2 1 0
0 0 0 0
0 24 27
0 24 30
821760 0 0 3 1
4 1 0
0 0 0 0
0 0 16
0 0 20
862390 0 0 4 0
2 2 0
0 0 0 0
0 6...

result:

ok 855185 lines