제출 #994824

#제출 시각아이디문제언어결과실행 시간메모리
994824ducksaysquack9월 (APIO24_september)C++17
100 / 100
422 ms12416 KiB
#include "september.h" #include <bits/stdc++.h> using namespace std; vector<vector<int>> adj(1e5+5); vector<bool> vis(1e5+5); vector<int> p(1e5+5); int c = -1; void dfs(int u) { if(vis[u]) return; vis[u] = true; c = max(c, p[u]); for(auto i:adj[u]) dfs(i); } int solve(int n, int m, vector<int> f, vector<vector<int>> s) { for(int i=1;i<n;i++) adj[f[i]].push_back(i); for(int j=0;j<m;j++) for(int i=0;i<n-1;i++) p[s[j][i]] = max(p[s[j][i]], i); int ans = 0; for(int i=0;i<n-1;i++) for(int j=0;j<m;j++) {if(i > c && j == 0) ans++; dfs(s[j][i]);} for(int i=0;i<adj.size();i++) adj[i].clear(); fill(begin(vis),end(vis),0); fill(begin(p),end(p),0); c = -1; return ans; }

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

september.cpp: In function 'int solve(int, int, std::vector<int>, std::vector<std::vector<int> >)':
september.cpp:18:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |  for(int i=0;i<adj.size();i++) adj[i].clear(); fill(begin(vis),end(vis),0); fill(begin(p),end(p),0);
      |              ~^~~~~~~~~~~
september.cpp:18:2: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   18 |  for(int i=0;i<adj.size();i++) adj[i].clear(); fill(begin(vis),end(vis),0); fill(begin(p),end(p),0);
      |  ^~~
september.cpp:18:48: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   18 |  for(int i=0;i<adj.size();i++) adj[i].clear(); fill(begin(vis),end(vis),0); fill(begin(p),end(p),0);
      |                                                ^~~~
#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...