fork(1) download
  1. using System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4. namespace ConsoleApplication2
  5. {
  6. class Program
  7. {
  8. static void Main()
  9. {
  10. long[] input = new long[3];
  11. input = Console.ReadLine().Split(' ').Select(n => Int64.Parse(n)).ToArray();
  12. Dictionary dictionary = new Dictionary();
  13. for (long i = 1; i <= input[2]; i++)
  14. {
  15. string str = Console.ReadLine();
  16. if (dictionary.ContainsKey(str.Trim()))
  17. dictionary[str] = dictionary[str] + 1;
  18. else
  19. dictionary[str] = 1;
  20. }
  21. for (long j = 1; j <= input[0]; j++)
  22. {
  23. long sum = 0;
  24. long localsum = 0;
  25. for (long l = input[1]; l > 1; l--)
  26. {
  27. long next=0, prev=0;
  28. if(dictionary.ContainsKey((j ) + " " + (l)))
  29. next=dictionary[(j ) + " " + (l)];
  30. if(dictionary.ContainsKey((j ) + " " + (l-1)))
  31. prev=dictionary[(j ) + " " + (l-1)];
  32. localsum = ((l) + next) - ((l - 1) + prev);
  33. if (localsum < 0)
  34. {
  35. sum = -1;
  36. break;
  37. }
  38. else
  39. {
  40. sum = sum + localsum;
  41. }
  42. }
  43. Console.WriteLine(sum);
  44. }
  45. }
  46. }
  47. }
Compilation error #stdin compilation error #stdout 0.04s 33976KB
stdin
6 4 10
1 1
2 2
3 3
4 4
5 1
5 2
5 1
5 4
6 1
6 1
compilation info
prog.cs(12,1): error CS0305: Using the generic type `System.Collections.Generic.Dictionary<TKey,TValue>' requires `2' type argument(s)
/usr/lib/mono/2.0/mscorlib.dll (Location of the symbol related to previous error)
prog.cs(16,5): error CS0841: A local variable `dictionary' cannot be used before it is declared
prog.cs(17,19): error CS0841: A local variable `dictionary' cannot be used before it is declared
prog.cs(17,1): error CS0841: A local variable `dictionary' cannot be used before it is declared
prog.cs(19,1): error CS0841: A local variable `dictionary' cannot be used before it is declared
prog.cs(28,4): error CS0841: A local variable `dictionary' cannot be used before it is declared
prog.cs(29,6): error CS0841: A local variable `dictionary' cannot be used before it is declared
prog.cs(30,4): error CS0841: A local variable `dictionary' cannot be used before it is declared
prog.cs(31,6): error CS0841: A local variable `dictionary' cannot be used before it is declared
Compilation failed: 9 error(s), 0 warnings
stdout
Standard output is empty