Submission #708999

# Submission time Handle Problem Language Result Execution time Memory
708999 2023-03-13T03:44:49 Z Sanzhar23 Diversity (CEOI21_diversity) C++14
0 / 100
7000 ms 340 KB
#include <bits/stdc++.h>

using namespace std;

#define ll long long	
#define pb push_back
#define bug cout << "bug" << endl
#define speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define all(x) x.begin(), x.end()
#define F first
#define S second
#define pll pair <ll, ll> 
#define pii pair <int, int> 
#define triple pair <pair <ll, ll> , ll>   
#define ull unsigned long long
#define ld long double
#define pinode pair <node*, node*>

const ll INF = 9e18 + 5;
const ll inf = 1e9 + 5;
const ll N = 3e5 + 5;
const ll shift = 2e6;
const ll mod = 998244353;
const ll mod2 = 1e9 + 9;
const ll M = 1e3 + 5;
const ll LOG = 21;
const ll sp = 263;
const ll sp2 = 9973;
const int block = 100;
const double eps = 1e-10;

int n, q;
int a[N];

int main(){
	speed;
	cin >> n >> q;
	for(int i = 1; i <= n; i++){
		cin >> a[i];
	}
	int l, r;
	cin >> l >> r;
	int ans = inf;
	do{
		int cur = 0;
		for(int i = 1; i <= n; i++){
			set <int> st;
			for(int j = i; j <= n; j++){
				st.insert(a[j]);
				cur += (int)st.size();
			}
		}
		ans = min(ans, cur);
	}
	while(next_permutation(a + 1, a + 1 + n));	
	cout << ans << endl;
}
/*	
%I64d6


		
		



%I64d
*/ 
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 4 ms 340 KB Output is correct
4 Correct 15 ms 328 KB Output is correct
5 Correct 329 ms 320 KB Output is correct
6 Correct 2348 ms 304 KB Output is correct
7 Correct 179 ms 304 KB Output is correct
8 Execution timed out 7038 ms 212 KB Time limit exceeded
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 7025 ms 212 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 7025 ms 212 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 7025 ms 212 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 4 ms 340 KB Output is correct
4 Correct 15 ms 328 KB Output is correct
5 Correct 329 ms 320 KB Output is correct
6 Correct 2348 ms 304 KB Output is correct
7 Correct 179 ms 304 KB Output is correct
8 Execution timed out 7038 ms 212 KB Time limit exceeded
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 4 ms 340 KB Output is correct
4 Correct 15 ms 328 KB Output is correct
5 Correct 329 ms 320 KB Output is correct
6 Correct 2348 ms 304 KB Output is correct
7 Correct 179 ms 304 KB Output is correct
8 Execution timed out 7038 ms 212 KB Time limit exceeded
9 Halted 0 ms 0 KB -