Show More
Commit Description:
[grader] better test case for timeout, changed where check_mem_usage is called to reduce inefficiency...
Commit Description:
[grader] better test case for timeout, changed where check_mem_usage is called to reduce inefficiency
git-svn-id: http://theory.cpe.ku.ac.th/grader/judge/trunk/scripts@167 6386c4cd-e34a-4fa8-8920-d93eb39b512e
References:
File last commit:
Show/Diff file:
Action:
test/data/test2_1-5sec.c
| 41 lines
| 543 B
| text/x-c
| CLexer
|
|
r22 | #include <stdio.h> | ||
|
r23 | #include <stdlib.h> | ||
|
r41 | #include <unistd.h> | ||
|
r43 | #include <sys/time.h> | ||
#include <time.h> | ||||
#include <sys/resource.h> | ||||
|
r22 | |||
int main() | ||||
{ | ||||
int a,b; | ||||
int c=0; | ||||
scanf("%d %d",&a,&b); | ||||
printf("%d\n",a+b); | ||||
|
r43 | struct rusage ru; | ||
|
r41 | |||
|
r43 | while(1) { | ||
c++; | ||||
b+=c; | ||||
while(c<1000000000) { | ||||
c++; | ||||
b+=c; | ||||
} | ||||
getrusage(RUSAGE_SELF,&ru); | ||||
if((ru.ru_utime.tv_sec + ru.ru_stime.tv_sec)>=1) | ||||
break; | ||||
} | ||||
printf("%d\n",b); | ||||
c=0; | ||||
while(c<100000000) { | ||||
|
r41 | c++; | ||
b+=c; | ||||
|
r22 | } | ||
|
r43 | if(b==10) | ||
printf("hello\n"); | ||||
|
r23 | exit(0); | ||
|
r22 | } | ||