Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma GCC optimize "-O3"
- #include <iostream>
- #include <vector>
- #include <chrono>
- using namespace std;
- using namespace std::chrono;
- int main() {
- high_resolution_clock::time_point roundStart = high_resolution_clock::now();
- int vec[1000000];
- for (int i = 0; i < 1000000; ++i) {
- vec[i] = i + 1;
- }
- for (int i = 0; i < 1000000; ++i) {
- int a = vec[i];
- }
- high_resolution_clock::time_point end = high_resolution_clock::now();
- duration<double> time_span = duration_cast<duration<double>>(end - roundStart);
- cout << (time_span.count() * 1000) << "ms" << endl;
- }
Add Comment
Please, Sign In to add comment