fork download
  1. #include <iostream>
  2. #include <set>
  3. using namespace std;
  4.  
  5. #define SZ 200
  6.  
  7. int main()
  8. {
  9. int t[SZ][SZ];
  10. for (int y=0; y<SZ; y++) {
  11. for (int x=0; x<SZ; x++) {
  12. std::set<int> s;
  13. for (int yy=0; yy<y; yy++)
  14. s.insert(t[yy][x]);
  15. for (int xx=0; xx<x; xx++)
  16. s.insert(t[y][xx]);
  17. int r;
  18. for (r=0; s.count(r); r++) {}
  19. t[y][x] = r;
  20. if (r != (x^y))
  21. {
  22. cout << "Incorrect :( " << endl;
  23. return 0;
  24. }
  25. }
  26. }
  27. cout << "It works!" << endl;
  28. }
  29.  
Success #stdin #stdout 1.43s 2892KB
stdin
Standard input is empty
stdout
It works!