Submission #524930

# Submission time Handle Problem Language Result Execution time Memory
524930 2022-02-10T10:33:26 Z Ziel Diversity (CEOI21_diversity) C++17
0 / 100
7000 ms 204 KB
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
#define sz(x) (int)x.size()

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);

	int n, q;
	cin >> n >> q;
	vector<int> a(n + 1);
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	vector<int> p(n + 1);
	iota(p.begin(), p.end(), 0);
	int _, __;
	cin >> _ >> __;
	ll ans = -1;
	do {
		ll cur = 0;
		for (int l = 1; l <= n; l++) {
			set<int> s;
			for (int r = l; r <= n; r++) {
				s.insert(a[p[r]]);
				cur += sz(s);
			}
		}
		if (ans == -1)
			ans = cur;
		ans = min(ans, cur);
	} while (next_permutation(p.begin() + 1, p.end()));
	cout << ans;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 7069 ms 204 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 7067 ms 204 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 7067 ms 204 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 7067 ms 204 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 7069 ms 204 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 7069 ms 204 KB Time limit exceeded
2 Halted 0 ms 0 KB -