Skip to content

Commit 5648a2d

Browse files
committed
vlad and cafes
1 parent 7ea98e7 commit 5648a2d

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

Free/B_vladAndCafes.cpp

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#include <bits/stdc++.h>
2+
#define all(x) x.begin(),x.end()
3+
#define msg(str,str2) cout << str << str2<< endl
4+
using namespace std;
5+
6+
using ll = long long;
7+
using ld = long double;
8+
using uint = unsigned int;
9+
using ull = unsigned long long;
10+
template<typename T>
11+
using pair2 = pair<T, T>;
12+
using pii = pair<int, int>;
13+
using pli = pair<ll, int>;
14+
using pll = pair<ll, ll>;
15+
16+
#define pb push_back
17+
#define mp make_pair
18+
19+
int gcd(int a,int b){
20+
if(a%b==0) return b;
21+
else return gcd(b,a%b);
22+
}
23+
24+
clock_t startTime;
25+
double getCurrentTime() {
26+
return (double)(clock() - startTime) / CLOCKS_PER_SEC;
27+
}
28+
void solve(){
29+
int n; cin>>n;
30+
map<int, int> map01;
31+
vector<int> vec(n);
32+
for(int e = 0,tmp ; e < n; e++){
33+
cin>>tmp;
34+
map01[tmp]++;
35+
vec[e] = tmp;
36+
}
37+
int sz = map01.size();
38+
map<int,int> map02;
39+
for(int e = n-1;e >= 0 ; e--){
40+
map02[vec[e]]++;
41+
if(map02.size() == sz){
42+
cout << vec[e] << endl;
43+
return;
44+
}
45+
}
46+
47+
}
48+
int main(){
49+
ios_base::sync_with_stdio(false);
50+
cin.tie(0);
51+
solve();
52+
return 0;
53+
}

0 commit comments

Comments
 (0)