fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. void fastscan(int &x)
  4. {
  5. bool neg=false;
  6. register int c;
  7. x =0;
  8. c=getchar();
  9. if(c=='-')
  10. {
  11. neg = true;
  12. c=getchar();
  13. }
  14. for(;(c>47 && c<58);c=getchar())
  15. x = (x<<1) + (x<<3) +c -48;
  16. if(neg)
  17. x *=-1;
  18. }
  19. int main()
  20. {
  21. int a,b,c,d,e,f,g,h;
  22. vector <int> ve;
  23. fastscan(a);
  24. h=0;
  25. for(b=0;b<a;b++)
  26. {fastscan(g);
  27. ve.push_back(g);
  28. }
  29. sort(ve.begin(),ve.end());
  30. for(b=0;b<a;b++)
  31. {
  32. if(b==0)
  33. {
  34. if(ve[b]!=ve[b+1])
  35. {
  36. break;
  37. }
  38. }
  39. else if(b==a-1)
  40. {
  41. if(ve[b]!=ve[b-1])
  42. {
  43. break;
  44. }
  45. }
  46. else
  47. {
  48. if(ve[b]!=ve[b-1] && ve[b]!=ve[b+1])
  49. break;
  50. }
  51. }
  52. cout<<ve[b]<<"\n";}
  53.  
Runtime error #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
Standard output is empty