版本比较
多方对拍
正文
增加 23 行删除 4 行
1234567810 行未改动1920212221232425262728293031323334353637383935 行未改动757677787980818283848586878889908091929394959697989910090101102103104105106107108109110111112113114981151161171181193 行未改动12312412512612712812913013113213313413513613740 行未改动racket.cpp
之前的 hash 存储管理有些问题,会炸掉,现在好了。
```cpp#include <string>#include <cstdio>#include <vector>10 行未改动{ if(filesystem::exists("D:\\working\\" + x + ".hash.bak")) { sstm("certutil -hashfile D:\\working\\" + x + ".cpp SHA256 > D:\\working\\" + x + ".hash"); if(!sstm("D:\\working\\diff.exe D:\\working\\" + x + ".hash D:\\working\\" + x + ".hash.bak")) if(!sstm("D:\\working\\diff.exe D:\\working\\" + x + ".hash D:\\working\\" + x + ".hash.bak")) { filesystem::remove("D:\\working\\" + x + ".hash"); // printf("Hash is the same. do not compile.\n"); return true; } if(sstm("g++ -std=c++17 -Ofast -march=native D:\\working\\" + x + ".cpp -o D:\\working\\" + x + ".exe")) { filesystem::remove("D:\\working\\" + x + ".hash"); // printf("Failed when compiling %s.cpp.\n", x.c_str()); return false; } filesystem::remove("D:\\working\\" + x + ".hash.bak"); filesystem::rename("D:\\working\\" + x + ".hash", "D:\\working\\" + x + ".hash.bak"); } else {35 行未改动 { printf("Failed when compiling maker.cpp.\n"); return 4; } printf("[log] build validator.cpp\n"); if(!do_compile("validator")) { printf("Failed when compiling validator.cpp.\n"); return 8; } for(const auto &x : names) { printf("[log] build %s.cpp\n", x.c_str()); if(!do_compile(x)) { printf("Failed when compiling %s.cpp.\n", x.c_str()); return 8; return 16; } } do { printf("[log] execute maker.exe\n"); int stat = 0; if(stat = sstm("D:\\working\\maker.exe > D:\\working\\data.in")) { printf("maker returned %d\n", stat); return 16; return 32; } printf("[log] execute validator.exe\n"); if(sstm("D:\\working\\validator.exe < D:\\working\\data.in")) { printf("Data invalid.\n"); continue; } for(const auto &x : names) { printf("[log] execute %s.exe\n", x.c_str()); if(stat = sstm("D:\\working\\" + x + ".exe < D:\\working\\data.in > D:\\working\\" + x + ".out")) { printf("%s.exe returned %d\n", x.c_str(), stat); return 32; return 64; } } for(int i=0;i+1<names.size();i++) {3 行未改动 printf("%s.out != %s.out.\n", names[i].c_str(), names[i+1].c_str()); goto ed; } } printf("Accepted.\n"); } while(true); ed: printf("Wrong Answer.\n"); return 0;}
```
diff.cpp(fc 太慢)
40 行未改动