冷门题 90分求助
查看原帖
冷门题 90分求助
1017253
xuan_never楼主2023/8/27 12:16

RT,WA#4,蒟蒻懒不会穷举

#include <iostream>
using namespace std;
int n, cnt[11], y = 6, sum, t[11], x;
int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 3; j++) {
			cin >> x;
			if (cnt[x] > 0) cnt[x]--;
			t[x]++;
		} for (int j = 0; j < 11; j++) {
			cnt[j] += t[j];
			t[j] = 0;
		}
	} for (int i = 0; i < 11; i++) {
		sum += cnt[i] * i;
		y -= cnt[i];
	} cout << sum + y << ' ' << sum + y * 6;
	return 0;
}
2023/8/27 12:16
加载中...