-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuckets.cpp
More file actions
37 lines (28 loc) · 734 Bytes
/
buckets.cpp
File metadata and controls
37 lines (28 loc) · 734 Bytes
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
// NOTE: it is recommended to use this even if you don't understand the following code.
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
using namespace std;
// input data
long long N, i;
vector<long long> D;
int main() {
// uncomment the following lines if you want to read/write from files
ifstream cin("input.txt");
ofstream cout("output.txt");
cin >> N;
D.resize(N);
for (long long i=0; i<N; i++)
cin >> D[i];
// insert your code here
bool ok = true;
sort(D.begin(), D.end());
for (long long i=1; i<N; i++) {
if (D[i] == D[i-1]) {
ok = false;
}
}
cout << (ok ? "Ok" : "Impossible") << endl; // print the result
return 0;
}