fork download
  1. using System.Collections.Generic;
  2. using System.Linq;
  3.  
  4. class cf2
  5. {
  6. static void Main()
  7. {
  8. string strInfo01 = Console.ReadLine();
  9.  
  10. long longCountA = long.Parse(strInfo01.Split()[0]);
  11. long longCountB = long.Parse(strInfo01.Split()[1]);
  12. long longCountAB = long.Parse(strInfo01.Split()[2]);
  13.  
  14. long longTotalCount = long.Parse(Console.ReadLine());
  15. long longTotalSum = 0;
  16. long longTotalBought = 0;
  17.  
  18. Dictionary<long, List<long>> dictInfo01 = new Dictionary<long, List<long>>();
  19. dictInfo01.Add(1, new List<long>());
  20. dictInfo01.Add(2, new List<long>());
  21.  
  22. Dictionary<long, LinkedList<long>> dictInfo02 = new Dictionary<long, LinkedList<long>>();
  23. dictInfo02.Add(1, new LinkedList<long>());
  24. dictInfo02.Add(2, new LinkedList<long>());
  25.  
  26. for (long i = 1; i <= longTotalCount; i++)
  27. {
  28. string strInfo02 = Console.ReadLine();
  29. string strInfo0201 = strInfo02.Split()[1].Substring(0, 1);
  30. long longValue = long.Parse(strInfo02.Split()[0]);
  31.  
  32. if (strInfo0201 == "U")
  33. {
  34. dictInfo01[1].Add(longValue);
  35. }
  36. else
  37. {
  38. dictInfo01[2].Add(longValue);
  39. }
  40. }
  41.  
  42. dictInfo01[1].Sort();
  43. dictInfo01[2].Sort();
  44.  
  45. foreach (var item in dictInfo01[1])
  46. {
  47. dictInfo02[1].AddLast(item);
  48. }
  49.  
  50. foreach (var item in dictInfo01[2])
  51. {
  52. dictInfo02[2].AddLast(item);
  53. }
  54.  
  55. for (long i = 1; i <= longTotalCount; i++)
  56. {
  57. long longSmaller = 0;
  58. long longFromWhich = 0;
  59.  
  60. if (dictInfo02[1].Count > 0)
  61. {
  62. longSmaller = dictInfo02[1].First();
  63. longFromWhich = 1;
  64. }
  65.  
  66. if (dictInfo02[2].Count > 0)
  67. {
  68. if (longFromWhich == 1)
  69. {
  70. if (dictInfo02[2].First() < longSmaller)
  71. {
  72. longSmaller = dictInfo02[2].First();
  73. longFromWhich = 2;
  74. }
  75. }
  76. else
  77. {
  78. longSmaller = dictInfo02[2].First();
  79. longFromWhich = 2;
  80. }
  81. }
  82. if (longFromWhich == 1)
  83. {
  84. dictInfo02[1].RemoveFirst();
  85. if (longCountA > 0)
  86. {
  87. FixNumbers(ref longCountA, ref longTotalSum, ref longSmaller, ref longTotalBought);
  88. }
  89. else if (longCountAB > 0)
  90. {
  91. FixNumbers(ref longCountAB, ref longTotalSum, ref longSmaller, ref longTotalBought);
  92. }
  93. }
  94. else if (longFromWhich == 2)
  95. {
  96. dictInfo02[2].RemoveFirst();
  97. if (longCountB > 0)
  98. {
  99. FixNumbers(ref longCountB, ref longTotalSum, ref longSmaller, ref longTotalBought);
  100. }
  101. else if (longCountAB > 0)
  102. {
  103. FixNumbers(ref longCountAB, ref longTotalSum, ref longSmaller, ref longTotalBought);
  104. }
  105.  
  106. }
  107. }
  108. Console.WriteLine("{0} {1}", longTotalBought, longTotalSum);
  109. }
  110.  
  111. private static void FixNumbers(ref long longCount,ref long LongTotalSum,ref long longSmaller,ref long longTotalBought)
  112. {
  113. longCount--;
  114. LongTotalSum += longSmaller;
  115. longTotalBought++;
  116. }
  117.  
  118. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(8,28): error CS0103: The name `Console' does not exist in the current context
prog.cs(14,42): error CS0103: The name `Console' does not exist in the current context
prog.cs(28,32): error CS0103: The name `Console' does not exist in the current context
prog.cs(108,9): error CS0103: The name `Console' does not exist in the current context
Compilation failed: 4 error(s), 0 warnings
stdout
Standard output is empty