Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <map>
  4. using namespace std;
  5.  
  6. typedef map<int, int> mii;
  7.  
  8. // 두번 등장하지 않은 수를 찾는다.
  9. int find(mii& dat){
  10. for(auto& a : dat){
  11. if(a.second != 2){
  12. return a.first;
  13. }
  14. }
  15. // 사실 없는 경우는 없다.
  16. return -1;
  17. }
  18.  
  19. vector<int> solution(vector<vector<int> > v) {
  20. mii x, y;
  21. for(int i=0; i<3; ++i){
  22. x[v[i][0]]++;
  23. y[v[i][1]]++;
  24. }
  25.  
  26. vector<int> ans(2);
  27. ans[0] = find(x);
  28. ans[1] = find(y);
  29. return ans;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement