void judge(string pid,string lang,string runid,string src) { if (src.length()<15) { toBottFile(runid,"0","0","Compile Error",""); return; } if (!login()) { writelog("Login error!\n"); toBottFile(runid,"0","0","Judge Error",""); return; } writelog("Logged In.\n"); lang=corrlang[lang]; //return; if (!submit(pid,lang,src)) { writelog("Submit error!\n"); toBottFile(runid,"0","0","Judge Error",""); return; } writelog("Submitted.\n"); //return; string result,ce_info,tu,mu; if (!getStatus(pid,lang,result,ce_info,tu,mu)) { writelog("Get Error!\n"); toBottFile(runid,"0","0","Judge Error",""); return; }; writelog("Got.\n"); toBottFile(runid,tu,mu,result,ce_info); }
void judge(string pid,string lang,string runid,string src) { /* minjie*/ db_client.insert("toj.Status", BSON("run_ID" << temp.runid << "result" << "Queuing" << "speed" << 50 << "submit_time" << temp.submit_time << "pid"<< temp.pid <<"lang"<<lang<<"username"<<temp.user<<"code_len"<< covert(src.length()))); db_client.insert("toj.Code", BSON("run_ID" << temp.runid << "code" << src)); if (src.length()<51) { toBottFile(runid,"0","0","Compile Error",""); return; } if (!login()) { writelog("Login error!\n"); toBottFile(runid,"0","0","Judge Error",""); //minjie //puts("Login error"); return; } writelog("Logined\n"); lang=corrlang[lang]; if (!submit(pid,lang,src)) { writelog("Submit error!\n"); toBottFile(runid,"0","0","Judge Error",""); return; } writelog("Submitted\n"); string result,ce_info,tu,mu; if (!getStatus(pid,lang,result,ce_info,tu,mu)) { writelog("Get Error!\n"); toBottFile(runid,"0","0","Judge Error",""); return; }; toBottFile(runid,tu,mu,result,ce_info); }
void judge(string pid,string lang,string runid,string src) { if (src.length()<15) { toBottFile(runid,"0","0","Compile Error",""); return; } lang=corrlang[lang]; if (!logged) { if (!login()) { writelog("Login error!\n"); toBottFile(runid,"0","0","Judge Error",""); return; } else logged=true; } if (!submit(pid,lang,src)) { writelog("Submit error! Assume not logged in.\n"); if (!login()) { logged=false; writelog("Login error!\n"); toBottFile(runid,"0","0","Judge Error",""); return; } if (!submit(pid,lang,src)) { writelog("Assume should wait a while. Sleep 10 seconds.\n"); usleep(10000000); if (!submit(pid,lang,src)) { writelog("Submit error!\n"); toBottFile(runid,"0","0","Judge Error",""); return; } } } string result,ce_info,tu,mu; if (!getStatus(pid,lang,result,ce_info,tu,mu)) { writelog("Get Error!\n"); toBottFile(runid,"0","0","Judge Error",""); return; }; toBottFile(runid,tu,mu,result,ce_info); }