This commit is contained in:
Zengtudor 2024-08-18 10:01:04 +08:00
parent b6d7ceb4a1
commit 5332ef1a8b

View File

@ -84,13 +84,15 @@ struct Statu{
bool isTLE = false; bool isTLE = false;
int cmp; int cmp;
int id; int id;
std::chrono::duration<long, std::ratio<1, 1000>> spendTime;
friend std::ostream& operator<<(std::ostream &os,Statu &s){ friend std::ostream& operator<<(std::ostream &os,Statu &s){
if(s.isTLE){ if(s.isTLE){
os<<"tests\t"<<s.id<<"\tTLE"; os<<"tests\t"<<s.id<<"\tTLE";
}else if(s.cmp==0){ }else if(s.cmp==0){
os<<"tests\t"<<s.id<<"\tAC"; os<<"tests\t"<<s.id<<"\tAC\t"<<s.spendTime.count()<<"ms";
}else{ }else{
os<<"tests\t"<<s.id<<"\tWA line:"<<s.cmp; os<<"tests\t"<<s.id<<"\tWA line:"<<s.cmp<<"\t"<<s.spendTime.count()<<"ms";
} }
return os; return os;
} }
@ -234,12 +236,15 @@ int main(int argc, char* argv[]) {
} }
vector<Statu> status(jsonTests.size()+1); vector<Statu> status(jsonTests.size()+1);
auto a = std::chrono::duration_cast<std::chrono::milliseconds>(results[0].end-results[0].start);
for(int i=1;i<=jsonTests.size();i++){ for(int i=1;i<=jsonTests.size();i++){
printValue(tests[i].ans) printValue(tests[i].ans)
status[i]={ status[i]={
.isTLE=(results[i].id==0?true:false), .isTLE=(results[i].id==0?true:false),
.cmp=(results[i].id==0?0:compareFiles(results[i].outPath,tests[i].ans)), .cmp=(results[i].id==0?0:compareFiles(results[i].outPath,tests[i].ans)),
.id=i .id=i,
.spendTime = std::chrono::duration_cast<std::chrono::milliseconds>(results[i].end-results[i].start),
}; };
} }
cout<<endl<<"----------results---------"<<endl; cout<<endl<<"----------results---------"<<endl;
@ -253,6 +258,9 @@ int compareFiles(const std::string& path1, const std::string& path2) {
std::ifstream file1(path1); std::ifstream file1(path1);
std::ifstream file2(path2); std::ifstream file2(path2);
string s("cmping ");
LOG(s+path1+" "+path2)
if (!file1.is_open()) { if (!file1.is_open()) {
std::cerr << "cannot open the file at: " << path1 << std::endl; std::cerr << "cannot open the file at: " << path1 << std::endl;
exit(1); exit(1);