Skip to content

Commit 691a6bc

Browse files
committed
Extra checkpoint
1 parent 9eb1fd2 commit 691a6bc

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

cp-algo/util/checkpoint.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@
44
#include <chrono>
55
#include <string>
66
namespace cp_algo {
7+
template<bool final = false>
78
void checkpoint([[maybe_unused]] std::string const& msg = "") {
89
#ifdef CP_ALGO_CHECKPOINT
910
static double last = 0;
1011
double now = (double)clock() / CLOCKS_PER_SEC;
1112
double delta = now - last;
1213
last = now;
1314
if(msg.size()) {
14-
std::cerr << msg << ": " << delta * 1000 << " ms\n";
15+
std::cerr << msg << ": " << (final ? now : delta) * 1000 << " ms\n";
1516
}
1617
#endif
1718
}

verify/poly/wildcard.test.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@ string matches(string const& A, string const& B, char wild = '*') {
5858
void solve() {
5959
string a, b;
6060
cin >> a >> b;
61+
cp_algo::checkpoint("input");
6162
cout << matches(a, b) << "\n";
63+
cp_algo::checkpoint("output");
64+
cp_algo::checkpoint<true>("done");
6265
}
6366

6467
signed main() {

0 commit comments

Comments
 (0)