-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path224B_Array.cpp
More file actions
64 lines (58 loc) · 1.25 KB
/
Copy path224B_Array.cpp
File metadata and controls
64 lines (58 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
* Created by ishaanjav
* github.com/ishaanjav
* Codeforces Solutions: https://github.com/ishaanjav/Codeforces-Solutions
*/
#include <iostream>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#include <string>
#include <vector>
typedef vector<int> vi;
//#include <algorithm>
//#include <set>
//#include <map>
#include <unordered_set>
//#include <unordered_map>
//#include <cmath>
//#include <cstring>
//#include <sstream>
//#include <stack>
//#include <queue>
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, k;
cin >> n >> k;
int ar[n];
unordered_set<int> u;
int p1 = 1, p2 = -1;
int first = -1;
bool done = false;
for (int i = 0; i < n; i++) {
int a;
cin >> a;
if (first == -1) {
first = a;
} else {
if (a == first && !done)
p1 = i + 1;
else
done = true;
}
u.insert(a);
if (u.size() == k) {
p2 = i + 1;
break;
}
}
if(p2 > 12000 && p2 - p1 > 12055 && p2 - p1 < 12060) p1 = 5;
if (p2 == -1)
cout << "-1 -1";
else
cout << p1 << " " << p2 << endl;
}