제출 #1064255

#제출 시각아이디문제언어결과실행 시간메모리
1064255MarwenElarbi수천개의 섬 (IOI22_islands)C++17
10 / 100
24 ms6228 KiB
#include "islands.h" #include <bits/stdc++.h> using namespace std; #define pb push_back #define ll long long #define fi first #define se second vector<pair<int,int>> adj[405]; std::variant<bool, std::vector<int>> find_journey( int N, int M, std::vector<int> U, std::vector<int> V) { vector<int> a; vector<int> b; for (int i = 0; i < M; ++i) { (U[i]==0 ? a : b).pb(i); adj[U[i]].pb({V[i],i}); } if(a.size()>=2&&b.size()>=1){ if(N==2) return vector<int> ({a[0],b[0],a[1],a[0],b[0],a[1]}); else{ int x=adj[0][0].fi; int y=adj[0][1].fi; int c,d; for(auto u:adj[x]) if(u.fi==0) c=u.se; for(auto u:adj[y]) if(u.fi==0) d=u.se; return vector<int> ({adj[0][0].se,c,adj[0][1].se,d,c,adj[0][0].se,d,adj[0][1].se}); } } return false; }

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

islands.cpp: In function 'std::variant<bool, std::vector<int, std::allocator<int> > > find_journey(int, int, std::vector<int>, std::vector<int>)':
islands.cpp:26:88: warning: 'd' may be used uninitialized in this function [-Wmaybe-uninitialized]
   26 |       return vector<int> ({adj[0][0].se,c,adj[0][1].se,d,c,adj[0][0].se,d,adj[0][1].se});
      |                                                                                        ^
islands.cpp:26:88: warning: 'c' may be used uninitialized in this function [-Wmaybe-uninitialized]
#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...