Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions f1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,19 @@ bool F1::run()
}

vector<pair<int, int>> edges;
edges.reserve(N - 1 + (total - K)); // Reserve space to avoid reallocations
for (int i = 2; i <= N; ++i)
{
edges.push_back({1, i});
edges.emplace_back(1, i);
}

for (int i = 2; i < N && total > K; ++i)
{
for (int j = i + 1; j <= N && total > K; ++j, --total)
{
edges.push_back({i, j});
edges.emplace_back(i, j);
}
}

return true;
}
}
13 changes: 10 additions & 3 deletions high_load.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#include <boost/container/stable_vector.hpp>
#include <map>
#include <boost/container/flat_map.hpp>
#include <cstdlib>
#include <ctime>
#include "high_load.h"

#include <bits/stdc++.h>
Expand All @@ -18,8 +23,10 @@ bool BenchmarkRunner::benchmark(){
// Insert random keys
for (int i = 0; i < 1000; i++) {
int random_key = rand() % 100000;
test_map[random_key] = 0;
test_keys.push_back(random_key);
auto result = test_map.insert(std::make_pair(random_key, 0));
if (result.second) {
test_keys.push_back(random_key);
}
}

for (int key : test_keys) {
Expand All @@ -28,4 +35,4 @@ bool BenchmarkRunner::benchmark(){
map<int, int> m;
}
return true;
}
}
Empty file modified post_test.sh
100755 → 100644
Empty file.