ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1330. Intervals

Test #20
Posted by Jarlax 28 Mar 2007 02:37
My 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:49
I 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 :)