I have solved problems in online judges like uva/timus/live archive/lightoj where there is no time limit for a particular case but a limit for the whole data set. I want to know how it works in codeforces and sgu where we have time limit per test case. I need clarification for two scenarios
1) In judges like uva and in the acm icpcs, we can precalculate stuffs. Like we can generate prime numbers in advanced, calculate nCr for some n and r before working with individual cases and need not generate these stuffs later while working with each test case. But, for codeforces and sgu, this is useless right? As my code will be executed newly for each test case. So no point of precalculation right? Whatever I need, I will have to generate/calculate for every single test case??
2) The time limits in uva or similar site is usually around 1-3 secs. That's for the whole dataset. And in codeforces/sgu, we have 0.5 sec (around 1 sec) for each case. That means, my solution in codeforces/sgu for 0.5 sec time limit can have around 5*10^7 instructions as that will take around 0.5 secs. Isn't that less challenging compared to solving a problem with around 10^6 instructions in timus/uva/icpc style sites? Shall we approach a problem which has time limit of 3 sec in timus and time limit of 0.5 sec per test case in sgu in the same way both the sites?
I feel I am missing the whole idea behind this time limit per test case system. I know there is nothing as less challenging or whatsoever, but I just need to get clarified. Any DETAILED explanation would be really helpful.
Thanks in advance.








Time limit for each problem set it's author. Author must to test different solutions and chose time limit in a way where fast enough solution gets AC and slow gets TL. Author prepares problem he must to decide it is multitest problem or problem for one test case, and then choses TL accordingly.
But I am not asking about how the limits are set. I want the difference between the two systems. Please help me clear the confusions with the points I have mentioned.
Time limits like here or on sgu are much more traditional for Russia and other NEERC contries. It have som problems, like you said. But other one have some other problems. Often testsets are not good-limited. So you should use intuition to understand what author realy mean. How much maximal tests can there be and etc. In NEERC-style limits you autors mostly try to do, that if you pass system tests, you will pass any test, which satisfies statement.
" Often testsets are not good-limited. So you should use intuition to understand what author realy mean. How much maximal tests can there be and etc."---Are you talking about the uva/icpc time limit style here?
"In NEERC-style limits you autors mostly try to do, that if you pass system tests, you will pass any test, which satisfies statement"---Can you please explain again, i did not get you here. :)
If you said, that N is less than 10^5, and there are 50 testcases, in NEERC-style contest there will be test with 50 testcases with N about 10^5. It uva/icpc there probably be many small testcases and couple max testcase. So in fact, you will have the same 0.5 seconds on each test, because other 45 will work momentally.
Well I have authored some problems in icpc style online judges. I think, there, we solve problem assuming worst case for all test cases. I made data sets where for all test cases, N is maximum. For example, a problem has 100 test cases and time limit of 1 sec. N=10^6.Therefore, the solution that I will have for this problem will be O(N) assuming worst case for all cases as 100 * 10^6 is around 1 sec. So, while solving this problem in an icpc style site, my solution will have around 10^6 instructions but for the same problem in codeforces/sgu, assuming worst case for all case, and time limit of 0.5 sec per case, my solution can have around 5*10^7 and get an AC. So, how do we explain such scenario?
Can you give me an example where time limit per case is more challenging than time limit for whole dataset assuming the dataset is strong for both the case. Please note that I am new to time limit per test case style and I need to get a good grab on it. I am not saying its less challenging or anything like that, I know all top coders compete here, I just need to clear myself out.
This is not more or less chalanging. This is just different. It will cause bigger limits if need, or other. In fact, you will have almost the same time limit per test when there one big testcase. Or you will have less time, but limits will be smaller too.
Am I the only one who doesn't understand what author wants?
You are far from being the only ... after all that explanation, he still continues with the same question.
I think time limit per test case is more general than time limit per whole data set. You can still multiple test in one file if you prefer it that way.
Problems with time limit per whole data set:
Input file may be too big.
For problem with LOTS of small tricky cases, it becomes harder for problem setter to find ideal time limits.
Impossible to see difference with O(N) algo which run slows for both small & big tests and O(NlogN) algo which run fast for small test & slow for big tests.
And I think time limit for whole data sets is less popular than you think. Please download test data of ACM WF 2012 to see they have lots of input files or try solving a timus problems with 100 test cases and see your displayed running time.