Ahmed_Negm

Untitled

Mar 9th, 2022
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.88 KB | None | 0 0
  1. #include<iostream>
  2. #include<cmath>
  3. #include<iomanip>
  4. #include<algorithm>
  5. #include<cstdlib>
  6. #include<cstring>
  7. #include<vector>
  8.  
  9. #define ll long long
  10. #define sz(x) int(x.size())
  11. #define all(x) x.begin(),x.end()
  12. using namespace std;
  13.  
  14. void Fast_IO(){
  15.     ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
  16.     #ifndef ONLINE_JUDGE
  17.         freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
  18.     #endif
  19. }
  20.  
  21.  
  22.  
  23.  
  24.  
  25. void solve(){
  26.  
  27. int n;
  28. cin>>n;
  29. vector<int>v;
  30. int counter =0,ans=0;
  31. for(int i =0; i<2*n; i++){
  32.     int x; cin>>x;
  33.     v.push_back(x);
  34. }
  35. for(int i = 0; i<2*n;i++){
  36.    
  37.     if(counter>ans) ans = counter;
  38.     for(int j =0; j<i; j++){
  39.     if(v[i]==v[j]) counter-=2;
  40.     }
  41.      counter++;
  42. }
  43.  
  44.  cout<<ans;
  45.  
  46. }
  47.  
  48. int main(){
  49.     Fast_IO();
  50. int t =1;
  51. //cin>>t;
  52. while(t--){
  53. solve();
  54. }
  55. return 0;
  56. }
Advertisement
Add Comment
Please, Sign In to add comment