제출 #825724

#제출 시각아이디문제언어결과실행 시간메모리
825724top34051수천개의 섬 (IOI22_islands)C++17
10 / 100
23 ms4356 KiB
#include "islands.h" #include <variant> #include <vector> std::variant<bool, std::vector<int>> find_journey(int N, int M, std::vector<int> U, std::vector<int> V) { // Subtask 1 if (N == 2) { std::vector<int> way, yaw; for (int i = 0; i < M; ++i) { int u = U[i], v = V[i]; if (u == 0) { way.push_back(i); } else { yaw.push_back(i); } } if ((int)way.size() >= 2 && (int)yaw.size() >= 1) { return std::vector({way[0], yaw[0], way[1], way[0], yaw[0], way[1]}); } } // Subtask 2 if (N >= 2) { std::vector<std::vector<int>> id(3, std::vector<int>(3, -1)); for (int i = 0; i < M; ++i) { int u = U[i], v = V[i]; if (u * v == 0 && u <= 2 && v <= 2) { id[u][v] = i; } } if (id[0][1] != -1 && id[1][0] != -1 && id[0][2] != -1 && id[2][0] != -1) { return std::vector({id[0][1], id[1][0], id[0][2], id[2][0], id[1][0], id[0][1], id[2][0], id[0][2]}); } } 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:13:21: warning: unused variable 'v' [-Wunused-variable]
   13 |       int u = U[i], v = V[i];
      |                     ^
#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...