Skip to content

Instantly share code, notes, and snippets.

@takuzoo3868
Last active November 18, 2017 07:18
Show Gist options
  • Save takuzoo3868/720ca3f9c619c2eb2823721642a9506c to your computer and use it in GitHub Desktop.
Save takuzoo3868/720ca3f9c619c2eb2823721642a9506c to your computer and use it in GitHub Desktop.
🕒 Processing time measurement template for competition programming
#include <iostream>
#include <chrono>
using namespace std;
int main() {
// 計測開始時刻を保存
auto start = std::chrono::system_clock::now();
/*
* 処理
*/
// 計測終了時刻の保存
auto end = std::chrono::system_clock::now();
// 処理時間の計算
auto dur = end - start;
auto micro = std::chrono::duration_cast<std::chrono::microseconds>(dur).count();
// マイクロ秒単位で表示
std::cout << micro << " micro sec \n";
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment