Skip to content

Гусев Иван 312 группа #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

4eburxn
Copy link

@4eburxn 4eburxn commented Jan 16, 2025

No description provided.

4eburxn and others added 5 commits January 16, 2025 12:41

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

There were too many comments to post at once. Showing the first 15 out of 69. Check the log or trigger a new build to see more.

std::vector<node> nodes;
std::vector<int> ans;

int N=5;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'N' of type 'int' can be declared 'const' [misc-const-correctness]

Suggested change
int N=5;
int const N=5;

/*ans = solution(nodes);*/

for(int i = ans.size()-1;i>=0;i--){
std::cout<<ans[i]<<" ";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]

 = ans.size()-1;i>=0;i--){
   ^

std::vector<int> solution(std::vector<node> nodes){
std::deque<int> gray;
std::vector<int> ans;
int N = nodes.size(),tmp=0;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]

  int N = nodes.size(),tmp=0;
          ^

std::vector<int> solution(std::vector<node> nodes){
std::deque<int> gray;
std::vector<int> ans;
int N = nodes.size(),tmp=0;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'N' of type 'int' can be declared 'const' [misc-const-correctness]

  int N = nodes.size(),tmp=0;
  ^

/*gray.push_back(0);*/
node *current;

tmp=0;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: Value stored to 'tmp' is never read [clang-analyzer-deadcode.DeadStores]

  tmp=0;
  ^
Additional context

task_01/src/solution.cpp:16: Value stored to 'tmp' is never read

  tmp=0;
  ^

std::vector<int> ans;

int N=3;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'N' of type 'int' can be declared 'const' [misc-const-correctness]

Suggested change
int N=3;
int const N=3;

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

There were too many comments to post at once. Showing the first 15 out of 68. Check the log or trigger a new build to see more.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

There were too many comments to post at once. Showing the first 15 out of 68. Check the log or trigger a new build to see more.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

There were too many comments to post at once. Showing the first 15 out of 69. Check the log or trigger a new build to see more.

int N = nodes.size(), tmp = 0;
for (int i = 0; i < N; i++) {
nodes[i].id = i;
std::sort(nodes[i].neighbours.begin(), nodes[i].neighbours.end());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

из-за этого у нас будет сложность большая, в самом худшем поличиться nnlog(n)

ans = solution(nodes);
std::vector<int> assertion = {0, 1, 2};
ASSERT_TRUE(assertion.size() == ans.size());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ASSERT_EQ лучше использовать

#include <utility>
#include <vector>

static std::vector<int> h, d;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

статические переменные не самая хорошая идея(

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

кажется пролез лишний файл(

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

кодстайл немного не тот, и грязноватый код, не только в этом файле

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants