[email protected] a écrit :

> Can someone suggest me how to find out the the time taken by our C/C++ 
> program to run..! Many of the online judges such as spoj.pl come up 
> saying runtime exceeded and stuff! How can we find out the time taken by 
> ourselves!???


I ever made a program that operates like a grader for online judge. And 
I used this to limit the runtime to t seconds.

double runLimit = t;
struct rlimit tlimit;
tlimit.rlim_cur = runLimit + 1;
tlimit.rlim_max = runLimit + 2;
setrlimit(RLIMIT_CPU, &tlimit);


The program will be terminated when it exceeds t seconds.

Reply via email to