제출 #1050747

#제출 시각아이디문제언어결과실행 시간메모리
1050747starrPaths (BOI18_paths)C++17
23 / 100
1 ms604 KiB
#include <bits/stdc++.h> using namespace std; int n, m, k; vector<int> adj[105], col(105); int ans = 0; void dfs(int nd, int cnt, vector<int> a){ a.push_back(col[nd]); if(cnt > 4){ return; } else if (cnt >= 2){ vector<int> temp(6); for(int i = 0; i < temp.size(); i++) temp[i] = 0; int ada = 1; for(auto x : a){ if(temp[x] == 1) ada = 0; temp[x] = 1; } if(ada) ans++; else return; } for(auto x : adj[nd]){ dfs(x, cnt + 1, a); } } int main(){ cin >> n >> m >> k; for(int i = 0; i < n; i++) cin >> col[i]; for(int i = 0; i < m; i++){ int a, b; cin >> a >> b; --a, --b; adj[a].push_back(b); adj[b].push_back(a); } for(int i = 0; i < n; i++){ dfs(i, 1, {}); } cout << ans << endl; }

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

paths.cpp: In function 'void dfs(int, int, std::vector<int>)':
paths.cpp:16:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |         for(int i = 0; i < temp.size(); i++) temp[i] = 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...