Submission #952969

#TimeUsernameProblemLanguageResultExecution timeMemory
952969SacharlemagneDiversity (CEOI21_diversity)C++17
0 / 100
7087 ms600 KiB
#include <bits/stdc++.h> using namespace std; int main() { //ios_base::sync_with_stdio(false); cin.tie(nullptr); int n,q; cin >> n >> q; vector<int> v(n); for (int i = 0; i<n; ++i) cin >> v[i]; //while (q--) { long long fin = 4e18; int L, R; cin >> L >> R; --L; --R; //vector<int> v(R-L+1); for (int i = 0; i<R-L+1; ++i) v[i] = vv[i+L]; do { //int l,r; cin >> l >> r; --l; long long ans = 0; for (int i = 0; i < n; ++i) { set<int> s; for (int j = i; j < n; ++j) { s.insert(v[j]); ans += s.size(); } } fin = min(fin, ans); } while (std::next_permutation(v.begin(), v.end())); cout << fin; //} return 0; } /* * */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...