Submission #524928

# Submission time Handle Problem Language Result Execution time Memory
524928 2022-02-10T10:31:52 Z Ziel Diversity (CEOI21_diversity) C++17
Compilation error
0 ms 0 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 >> _ >> __;
	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[r]);
				cur += sz(s);
			}
		}
		if (ans == -1)
			ans = cur;
		ans = min(ans, cur);
	} while (next_permutation(a.begin() + 1, a.end()));
	cout << ans;
	return 0;
}

Compilation message

diversity.cpp: In function 'int main()':
diversity.cpp:8:16: error: found ':' in nested-name-specifier, expected '::'
    8 |  ios_base::sync:with_stdio(false);
      |                ^
      |                ::
diversity.cpp:8:12: error: 'std::ios_base::sync' has not been declared
    8 |  ios_base::sync:with_stdio(false);
      |            ^~~~