Show More
Commit Description:
translates test_request input/output file paths for remote grading test_request
Commit Description:
translates test_request input/output file paths for remote grading test_request
File last commit:
Show/Diff file:
Action:
test/data/test2_05sec.c | 56 lines | 974 B | text/x-c | CLexer |
jittat
[grader] added fractional timelimit...
r51 #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
Jittat Fakcharoenphol
reports running time, checks exit status; modified running time test case, memory test case.
r114 #include <windows.h>
// run it for 0.5 s
jittat
[grader] added fractional timelimit...
r51
Jittat Fakcharoenphol
reports running time, checks exit status; modified running time test case, memory test case.
r114 double get_running_time()
{
FILETIME creation_time;
FILETIME exit_time;
FILETIME kernel_time;
FILETIME user_time;
GetProcessTimes(GetCurrentProcess(),
&creation_time,
&exit_time,
&kernel_time,
&user_time);
SYSTEMTIME sys_kernel_time;
SYSTEMTIME sys_user_time;
FileTimeToSystemTime(&kernel_time, &sys_kernel_time);
FileTimeToSystemTime(&user_time, &sys_user_time);
double time_used =
((sys_kernel_time.wSecond + sys_kernel_time.wMilliseconds/1000.0) +
(sys_user_time.wSecond + sys_user_time.wMilliseconds/1000.0));
return time_used;
}
jittat
[grader] added fractional timelimit...
r51
int main()
{
int a,b;
int c=0;
jittat
fixed engine test source codes to avoid gcc warning of unused return values...
r75 int r;
jittat
[grader] added fractional timelimit...
r51
jittat
fixed engine test source codes to avoid gcc warning of unused return values...
r75 r = scanf("%d %d",&a,&b);
jittat
[grader] added fractional timelimit...
r51 printf("%d\n",a+b);
while(1) {
c++;
b+=c;
while(c<100000) {
c++;
b+=c;
}
Jittat Fakcharoenphol
reports running time, checks exit status; modified running time test case, memory test case.
r114 if(get_running_time() > 0.5)
jittat
[grader] added fractional timelimit...
r51 break;
}
printf("%d\n",b);
exit(0);
}