Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std ;
- #define sz(s) int(s.size())
- #define all(v) v.begin() , v.end()
- #define imin INT_MIN
- #define imax INT_MAX
- typedef long long ll ;
- void ABDEL3AL () {
- ios_base::sync_with_stdio(false); cin.tie(nullptr) , cout.tie(nullptr) ;
- #ifndef ONLINE_JUDGE
- freopen("input.txt" , "r" , stdin) , freopen("output.txt" , "w" , stdout) ;
- #endif
- }
- int main() {
- ABDEL3AL() ;
- int n , cnt = 0 , Max = imin ;
- cin >> n ;
- int arr[n] , freq[n + 1] = {0} ;
- for (int i = 0; i < n * 2; i++) {
- cin >> arr[i] , freq[arr[i]]++ ;
- cnt++ ;
- if (freq[arr[i]] == 2) cnt -= 2 ;
- Max = max (cnt , Max) ;
- }
- cout << Max ;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement