GCC Code Coverage Report


Directory: ./
File: tasks/yushkova_p_min_in_matrix/seq/src/ops_seq.cpp
Date: 2026-02-23 23:20:07
Exec Total Coverage
Lines: 0 24 0.0%
Functions: 0 5 0.0%
Branches: 0 12 0.0%

Line Branch Exec Source
1 #include "yushkova_p_min_in_matrix/seq/include/ops_seq.hpp"
2
3 #include <algorithm>
4 #include <cstddef>
5 #include <cstdint>
6 #include <vector>
7
8 #include "yushkova_p_min_in_matrix/common/include/common.hpp"
9
10 namespace yushkova_p_min_in_matrix {
11
12 namespace {
13
14 inline int GenerateValue(int64_t i, int64_t j) {
15 constexpr int64_t kA = 1103515245LL;
16 constexpr int64_t kC = 12345LL;
17 constexpr int64_t kM = 2147483648LL;
18
19 int64_t seed = ((i % kM) * (100000007LL % kM) + (j % kM) * (1000000009LL % kM)) % kM;
20 seed = (seed ^ 42LL) % kM;
21 int64_t val = ((kA % kM) * (seed % kM) + kC) % kM;
22
23 return static_cast<int>((val % 2000001LL) - 1000000LL);
24 }
25
26 } // namespace
27
28 YushkovaPMinInMatrixSEQ::YushkovaPMinInMatrixSEQ(const InType &in) {
29 SetTypeOfTask(GetStaticTypeOfTask());
30 GetInput() = in;
31 GetOutput().clear();
32 }
33
34 bool YushkovaPMinInMatrixSEQ::ValidationImpl() {
35 return GetInput() > 0 && GetOutput().empty();
36 }
37
38 bool YushkovaPMinInMatrixSEQ::PreProcessingImpl() {
39 auto &out = GetOutput();
40 out.clear();
41 out.reserve(GetInput());
42 return true;
43 }
44
45 bool YushkovaPMinInMatrixSEQ::RunImpl() {
46 const InType n = GetInput();
47 if (n <= 0) {
48 return false;
49 }
50
51 auto &out = GetOutput();
52 out.clear();
53 out.reserve(n);
54
55 for (InType row = 0; row < n; ++row) {
56 InType row_min = GenerateValue(static_cast<int64_t>(row), 0);
57
58 for (InType col = 1; col < n; ++col) {
59 const InType val = GenerateValue(static_cast<int64_t>(row), static_cast<int64_t>(col));
60 row_min = std::min(row_min, val);
61 }
62
63 out.push_back(row_min);
64 }
65
66 return out.size() == static_cast<std::size_t>(n);
67 }
68
69 bool YushkovaPMinInMatrixSEQ::PostProcessingImpl() {
70 return GetOutput().size() == static_cast<std::size_t>(GetInput());
71 }
72
73 } // namespace yushkova_p_min_in_matrix
74