Submission #709121

# Submission time Handle Problem Language Result Execution time Memory
709121 2023-03-13T06:33:15 Z IamGalymzhan Diversity (CEOI21_diversity) C++14
0 / 100
1 ms 212 KB
#include <algorithm>
#include <iostream>
#include <iterator>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <set>
#include <map>
 
using namespace std;
 
#define speed ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define _ << ' ' <<
#define ll long long
#define ld long double
#define ull unsigned long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define all(x) x.begin(), x.end()
#define F first
#define S second
#define pb push_back 

const ll INF = (long long)2e18, mod = (long long)1e9+7;
const ll P = 263, Q = 319;
const ld eps = 1e-9;
 
const ll N = 50;

ll n, q;
ll a[N];

void solve() {
	cin >> n >> q;
	for (int i = 1; i <= n; ++i) {
		cin >> a[i];
	}
	while (q--) {
		ll l, r;
		cin >> l >> r;
		if (!(l == 1 && r == n)) {
			return;
		}
		ll ans = 0;
		sort(a + 1, a + n + 1);
		for (ll tl = 1; tl <= n; ++tl) {
			set<ll> s;
			for (ll tr = tl; tr <= n; ++tr) {
				s.insert(a[tr]);
				ans += s.size();
			}
		}
		cout << ans << endl;
	}
}

int main() {
	speed;
	int T = 1;
	// cin >> T;
	while (T--) {
		solve();
	}
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 1 ms 212 KB Output isn't correct
4 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 -
# 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 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 1 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 1 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -