Submission #684994

# Submission time Handle Problem Language Result Execution time Memory
684994 2023-01-23T04:24:02 Z moonhero Diversity (CEOI21_diversity) C++17
0 / 100
7000 ms 212 KB
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const long long N = 3e5 + 5;
signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int n, q; cin >> n >> q;
    vector <int> a(n);
    for (int i = 1; i <= n; i++) cin >> a[i];
    int ans = 0;
    for (int i = 0; i < n; i++) {
        set<int> s;
        for (int j = i; j < n; j++) {
            s.insert(a[j]);
            ans += s.size();
        }
    } while (next_permutation(a.begin(), a.end())) {
        int res = 0;
        for (int i = 0; i < n; i++) {
            set<int> s;
            for (int j = i; j < n; j++) {
                s.insert(a[j]);
                res += s.size();
            }
        } ans = min(ans, res);
    } cout << ans << '\n';
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 7049 ms 212 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 7049 ms 212 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 7049 ms 212 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -