제출 #1083303

#제출 시각아이디문제언어결과실행 시간메모리
1083303Math4Life2020Simurgh (IOI17_simurgh)C++17
0 / 100
1250 ms1048576 KiB
// Source: https://usaco.guide/general/io #include <bits/stdc++.h> #include <cstdio> using namespace std; #include "simurgh.h" using ll = long long; using pii = pair<ll,ll>; vector<int> find_roads(int N, vector<int> u, vector<int> v) { ll M = u.size(); vector<vector<int>> combs = {{-1}}; for (ll i=0;i<(N-1);i++) { vector<vector<int>> combs2; for (vector<int> v1: combs) { for (ll e=(v1[v1.size()-1]+1);e<M;e++) { vector<int> v2 = v1; v2.push_back(e); combs2.push_back(v2); } } combs = combs2; } for (vector<int> v1: combs) { vector<int> v; for (ll i=1;i<N;i++) { v.push_back(v1[i]); } ll f[N]; for (ll i=0;i<N;i++) { f[i]=i; } bool valid = 1; for (ll x: v) { ll a = u[x]; ll b=v[x]; while (a != f[a]) { a=f[a]; } while (b != f[b]) { b=f[b]; } if (a==b) { valid = 0; break; } else { f[a]=b; } } if (valid) { ll a0 = count_common_roads(v); if (a0 == (N-1)) { return v; } } } }

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

simurgh.cpp: In function 'std::vector<int> find_roads(int, std::vector<int>, std::vector<int>)':
simurgh.cpp:13:35: warning: control reaches end of non-void function [-Wreturn-type]
   13 |  vector<vector<int>> combs = {{-1}};
      |                                   ^
#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...