fork(2) download
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.IO;
  6.  
  7. class Myon
  8. {
  9. public Myon() { }
  10. public static int Main()
  11. {
  12. new Myon().calc();
  13. return 0;
  14. }
  15.  
  16. int T = 10;
  17. void calc()
  18. {
  19. Random r = new Random(2);
  20. List<int> l = new List<int>();
  21. while (true)
  22. {
  23. l.Add(r.Next(0, (1 << 20)));
  24. if (check(l)) break;
  25. }
  26. Console.WriteLine(l.Count);
  27. foreach (var item in l)
  28. {
  29. for (int j = 0; j < 10; j++)
  30. {
  31. Console.Write((((item >> (j * 2)) & 3) + 1) + " ");
  32. }
  33. Console.WriteLine();
  34. }
  35. }
  36.  
  37. bool check(List<int> l)
  38. {
  39. Dictionary<ulong, bool> dic = new Dictionary<ulong, bool>();
  40. for (int i = 0; i < (1 << 20); i++)
  41. {
  42. ulong p = 0;
  43. foreach (var item in l)
  44. {
  45. int count = 0;
  46. for (int j = 0; j < 10; j++)
  47. {
  48. if (((item >> (j * 2)) & 3) == ((i >> (j * 2)) & 3)) count++;
  49. }
  50. p <<= 4;
  51. p += (ulong)count;
  52. }
  53. if (dic.ContainsKey(p)) return false;
  54. dic[p] = true;
  55. }
  56. return true;
  57. }
  58.  
  59. }
  60.  
Success #stdin #stdout 2.12s 123520KB
stdin
Standard input is empty
stdout
15
2 4 1 1 4 1 1 1 2 4 
4 2 3 1 1 4 1 3 3 1 
4 4 1 2 2 2 1 3 3 4 
4 1 1 3 1 3 3 3 2 2 
1 3 2 3 3 2 2 1 4 3 
3 1 4 4 1 1 4 3 2 1 
4 2 4 2 3 2 2 3 4 3 
3 1 1 2 3 4 4 1 1 3 
1 4 3 1 2 4 1 4 2 4 
2 2 3 1 2 1 4 1 4 4 
1 1 1 1 1 2 2 2 2 4 
3 3 1 3 2 2 1 1 3 3 
3 3 2 3 2 3 3 2 4 1 
1 1 3 4 3 1 2 2 3 4 
3 2 2 2 2 1 2 4 1 1