제출 #1010404

#제출 시각아이디문제언어결과실행 시간메모리
1010404sleepntsheep9월 (APIO24_september)C++17
45 / 100
140 ms15856 KiB
#include "september.h" #include <cstdio> #include <algorithm> #include <vector> #include <array> int solve(int N, int M, std::vector<int> P/* F is patriarchy ! */, std::vector<std::vector<int>> S) { using i5 = std::array<int, 5>; std::vector<int> vis(N); std::vector<std::vector<int> > g(N); for (int i = 1; i < N; ++i) g[P[i]].push_back(i); std::vector<std::vector<int> > SI(M, std::vector<int>(N)); for (int i = 0; i < M; ++i) for (int j = 0; j < N - 1; ++j) SI[i][S[i][j]] = j; i5 at {}, at2 {}; auto dfs = [&](auto &&dfs, int u) -> void { vis[u] = 1; for (int i = 0; i < M; ++i) at2[i] = std::max(at2[i], SI[i][u] + 1); for (auto v : g[u]) if (!vis[v]) dfs(dfs, v); }; auto sheep = [&]() { at2 = at; for (int i = 0; i < M; ++i) { if (at[i] == N - 1) continue; dfs(dfs, S[i][at[i]]); for (int j = at[i] + 1; j < at2[i]; ++j) dfs(dfs, S[i][j]); } at = at2; }; int K = 0; for (; *std::min_element(at.begin(), at.begin() + M) < N - 1; ++K) sheep(); return K; }

컴파일 시 표준 에러 (stderr) 메시지

september.cpp: In function 'int solve(int, int, std::vector<int>, std::vector<std::vector<int> >)':
september.cpp:46:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   46 |     for (; *std::min_element(at.begin(), at.begin() + M) < N - 1; ++K)
      |     ^~~
september.cpp:49:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   49 |  return K;
      |  ^~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...