제출 #628876

#제출 시각아이디문제언어결과실행 시간메모리
628876welleyth수천개의 섬 (IOI22_islands)C++17
0 / 100
39 ms3100 KiB
#include "islands.h" #include <variant> #include <vector> #include <bits/stdc++.h> using namespace std; map<pair<int,int>,vector<int>> cnt; vector<int> ans; bool ok = true; void go1(int a,int b){ pair<int,int> A = {a,b}; pair<int,int> B = {b,a}; if(cnt[A].size() == 0){ ok = false; return; } ans.push_back(cnt[A][0]); return; } void go2(int a,int b){ pair<int,int> A = {a,b}; pair<int,int> B = {b,a}; if(cnt[B].size() == 0){ ok = false; return; } ans.push_back(cnt[B][0]); if(cnt[A].size() < 2){ ok = false; return; } ans.push_back(cnt[A][1]); ans.push_back(cnt[A][0]); ans.push_back(cnt[B][0]); ans.push_back(cnt[A][1]); return; } std::variant<bool, std::vector<int>> find_journey( int N, int M, std::vector<int> U, std::vector<int> V) { return true; for(int i = 0; i < M; i++){ cnt[{U[i],V[i]}].push_back(i); } for(int i = 0; i + 1 < N; i++){ go1(i,i+1); } for(int i = N-2; i >= 0; i--){ go2(i,i+1); if(!ok) return false; } return ans; }

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

islands.cpp: In function 'void go1(int, int)':
islands.cpp:13:19: warning: variable 'B' set but not used [-Wunused-but-set-variable]
   13 |     pair<int,int> B = {b,a};
      |                   ^
#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...