fork(14) download
  1. #include <vector>
  2. #include <utility>
  3. #include <iostream>
  4. #include <algorithm>
  5.  
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10. vector<pair<int, int> > result;
  11. for(int k = 0; k < 2; k++)
  12. for(int i = -1; i < 2; i += 2)
  13. for(int j = -1; j < 2; j+= 2)
  14. result.push_back(make_pair(i * (k+1), j * (((k + 1) % 2) + 1)));
  15.  
  16. for(vector<pair<int, int> >::iterator it = result.begin(); it != result.end(); it++)
  17. cout << "(" << it->first << ", " << it->second << ")" << endl;
  18.  
  19. return 0;
  20. }
  21.  
Success #stdin #stdout 0.02s 2856KB
stdin
Standard input is empty
stdout
(-1, -2)
(-1, 2)
(1, -2)
(1, 2)
(-2, -1)
(-2, 1)
(2, -1)
(2, 1)