E Why WA*7
  • 板块学术版
  • 楼主Vitamin_B
  • 当前回复20
  • 已保存回复20
  • 发布时间2024/7/13 22:00
  • 上次更新2024/7/14 08:51:58
查看原帖
E Why WA*7
743373
Vitamin_B楼主2024/7/13 22:00

rt

# pragma GCC optimize("Ofast,no-stack-protector")

# pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

# include <bits/stdc++.h>

# define I return

# define AK 0

# define IOI ;

using namespace std;

typedef long long ll;

typedef pair <int, int> pii;

const int mod = 998244353;

struct node {

	int step, end, x;

	bool operator < (const node& a) const {

		return step != a.step ? step < a.step : end != a.end ? end < a.end : x < a.x;

	}

} ;

int n, a[85], sum;

map <node, int> dp;

int main () {

	ios::sync_with_stdio (0);

	cin.tie (0);

	cout.tie (0);

	cin >> n;

	if (n == 1) {

		cout << '1';

		return 0;

	}

	cout << n << ' ' << n*(n - 1) / 2 << ' ';

	for (int i = 0; i < n; ++ i) {

		cin >> a[i];

		for (int j = 0; j < i; ++ j)
			dp[ {2, i, a[i] - a[j]}] = 1;

	}

	for (int k = 3; k <= n; ++ k) {

		sum = 0;

		for (int i = 0; i < n; ++ i)
			for (int j = i + 1; j < n; ++ j)
				dp[ {k, j, a[j] - a[i]}] += dp[ {k - 1, i, a[j] - a[i]}], dp[ {k, j, a[j] - a[i]}] %= mod, sum += dp[ {k - 1, i, a[j] - a[i]}], sum %= mod;

		cout << sum << ' ';

	}
//	cout << '\n';
//	for (auto i = dp.begin (); i != dp.end (); ++ i) cout << (i->first.step) << ',' << (i->first.end) << ',' << (i->first.x) << ':' << (i->second) << '\n';
	I AK IOI

}
2024/7/13 22:00
加载中...