diff --git a/src/main.cpp b/src/main.cpp index 169d4d5..055d0ec 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -22,8 +22,10 @@ int main(int argc, char *const argv[]) { cout << "Result for " << image << ":" << endl; auto res = simulator.simulate(image); if (!labels.empty()) { - for (unsigned int i = 0; i < res.size(); ++i) { - cout << res[i] << " " << labels[i] << endl; + auto scores = combine(res, labels); + sort(scores.begin(), scores.end(), greater<>()); + for (unsigned int i = 0; i < scores.size() && i < 5; ++i) { + cout << scores[i].first << " " << scores[i].second << endl; } } else { cout << "Best result: " << *(max_element(res.begin(), res.end())) << endl; diff --git a/src/utils.hpp b/src/utils.hpp index e7b43df..92e5f39 100644 --- a/src/utils.hpp +++ b/src/utils.hpp @@ -4,6 +4,7 @@ #include #include #include +#include namespace fmri { @@ -40,4 +41,17 @@ namespace fmri return res; } + template + std::vector> combine(const std::vector& a, const std::vector& b) + { + assert(a.size() == b.size()); + std::vector> res; + + for (size_t i = 0; i < a.size(); ++i) { + res.emplace_back(a[i], b[i]); + } + + return res; + } + } \ No newline at end of file