제출 #1051197

#제출 시각아이디문제언어결과실행 시간메모리
1051197Trent수천개의 섬 (IOI22_islands)C++17
10 / 100
18 ms5212 KiB
#include "islands.h" #include "bits/stdc++.h" using namespace std; #define forR(i, x) for(int i = 0; i < (x); ++i) #define REP(i, a, b) for(int i = (a); i < (b); ++i) #define all(x) x.begin(), x.end() typedef long long ll; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<ll> vll; typedef vector<bool> vb; struct edge{int t, i;}; vector<vector<edge>> adj; std::variant<bool, std::vector<int>> find_journey( int N, int M, std::vector<int> U, std::vector<int> V) { adj.resize(N); forR(i, M) { adj[U[i]].push_back({V[i], i}); } if(N == 2) { if(adj[0].size() < 2 || adj[1].size() < 1) return false; else { return vector<int> {adj[0][0].i, adj[1][0].i, adj[0][1].i, adj[0][0].i, adj[1][0].i, adj[0][1].i}; } } else { int ab, ba, ac, ca; forR(i, M) { if(U[i] == 0 && V[i] == 1) ab = i; else if(U[i] == 1 && V[i] == 0) ba = i; else if(U[i] == 0 && V[i] == 2) ac = i; else if(U[i] == 2 && V[i] == 0) ca = i; } return vector<int> {ab, ba, ac, ca, ba, ab, ca, ac}; } }

컴파일 시 표준 에러 (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:34:59: warning: 'ca' may be used uninitialized in this function [-Wmaybe-uninitialized]
   34 |         return vector<int> {ab, ba, ac, ca, ba, ab, ca, ac};
      |                                                           ^
islands.cpp:34:59: warning: 'ac' may be used uninitialized in this function [-Wmaybe-uninitialized]
islands.cpp:34:59: warning: 'ba' may be used uninitialized in this function [-Wmaybe-uninitialized]
islands.cpp:34:59: warning: 'ab' 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...