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;
int cmp;
int id;
std::chrono::duration<long, std::ratio<1, 1000>> spendTime;
friend std::ostream& operator<<(std::ostream &os,Statu &s){
if(s.isTLE){
os<<"tests\t"<<s.id<<"\tTLE";
}else if(s.cmp==0){
os<<"tests\t"<<s.id<<"\tAC";
os<<"tests\t"<<s.id<<"\tAC\t"<<s.spendTime.count()<<"ms";
}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;
}
@ -234,12 +236,15 @@ int main(int argc, char* argv[]) {
}
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++){
printValue(tests[i].ans)
status[i]={
.isTLE=(results[i].id==0?true:false),
.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;
@ -253,6 +258,9 @@ int compareFiles(const std::string& path1, const std::string& path2) {
std::ifstream file1(path1);
std::ifstream file2(path2);
string s("cmping ");
LOG(s+path1+" "+path2)
if (!file1.is_open()) {
std::cerr << "cannot open the file at: " << path1 << std::endl;
exit(1);