|  | 
|  | 
| back to board | Test #20 Posted by Jarlax  28 Mar 2007 02:37My C++ solution was successful with 0.14 sec and 284k. Now i wrote the same algorithm in C#, and on 20 test i have ML on
 char[] separator = { ' ', '\n', '\r', '\t' };
 string[] input = Console.In.ReadToEnd().Split(separator,
 StringSplitOptions.RemoveEmptyEntries);
 
 int k = 0;
 int n = int.Parse(input[k++]);
 ...
 
 And TL on
 
 int n = int.Parse(Console.ReadLine());
 ...
 
 So, how I should read input data in C# to have AC?
Re: Test #20 Posted by Jarlax  28 Mar 2007 02:49I got AC!In TL version i wrote in cycle
 
 string[] input = Console.ReadLine().Split(' ');
 int l = int.Parse(input[0]),
 r = int.Parse(input[1]);
 
 in AC version
 
 string input = Console.ReadLine();
 int pos = input.IndexOf(' ');
 int l = int.Parse(input.Substring(0, pos)),
 r = int.Parse(input.Substring(pos + 1));
 
 Whith this optimization program works 0.047 sec less, and i got AC :)
 | 
 | 
|