#include<bits/stdc++.h> #include <iostream> #include <vector> #include <utility> #include <iterator> #include <algorithm> #include <deque> #include <cmath> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int N ; cin>>N ; vector<int>v(N+N) ; vector<int>fre(N,0) ; int Mx=0 ; int big =-1 ; for(auto i:v){ cin>>i ; fre[i]++; if(fre[i]==2){ fre[i]=0 ; Mx-- ; } else { Mx++ ; } big=max(Mx,big); } cout<<big<<endl; return 0; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter