Hi Codeforces. Today i saw GreenGrape solution of the problem D. Robot Vacuum Cleaner : solution. And i find there :
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
while (t--) {
clock_t z = clock();
solve();
debug("Total Time: %.3f\n", (double)(clock() - z) / CLOCKS_PER_SEC);
}
With this code he gets execution time of function solve()
. clock()
gives you current time. I have wrote helpful directive
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#ifndef time__
#define time__(data)for (long blockTime = NULL; (blockTime == NULL ? (blockTime = clock()) != NULL : false); debug("%s : %.4fs" ,data ,(double) (clock() - blockTime) / CLOCKS_PER_SEC))
#endif