Submission #524934

# Submission time Handle Problem Language Result Execution time Memory
524934 2022-02-10T10:50:45 Z Ziel Diversity (CEOI21_diversity) C++17
0 / 100
1 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];
	}
	sort(a.begin() + 1, a.end());
	int _, __;
	cin >> _ >> __;

	set<int> s{a.begin() + 1, a.end()};
	int x = n - sz(s) + 1;

	ll ans = n * (n + 1) / 2ll;
	int c = 0, y = n - 1;
	for (int i = x + 1; i <= n; i++) {
		if (c == 2) {
			c = 0;
			y++;
		}
		ans += y;
		c++;
	}

	cout << ans;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -