제출 #840429

#제출 시각아이디문제언어결과실행 시간메모리
840429ogkostya가장 긴 여행 (IOI23_longesttrip)C++17
5 / 100
12 ms336 KiB
#include "longesttrip.h" std::vector<int> longest_trip(int N, int D) { std::vector<int> an1 = {}; std::vector<int> an2 = {}; an1.push_back(0); std::vector<int> temp1 = {}; std::vector<int> temp2 = {}; for (int i = 1; i < N; i++) { temp1.clear(); temp1.push_back(i); temp2.clear(); temp2.push_back(an1.back()); if (are_connected(temp1, temp2)) { an1.push_back(i); } else { if (an2.size() == 0) { an2.push_back(i); } else { temp2.clear(); temp2.push_back(an2.back()); if (are_connected(temp1, temp2)) { an2.push_back(i); } else { while (an2.size() > 0) { an1.push_back(an2.back()); an2.pop_back(); } an2.push_back(i); } } } } if (an2.size() > 0) { temp1.clear(); temp1.push_back(an1.back()); temp2.clear(); temp2.push_back(an2.back()); if (are_connected(temp1, temp2)) { while (an2.size() > 0) { an1.push_back(an2.back()); an2.pop_back(); } } else { temp2.clear(); temp2.push_back(an2.front()); if (are_connected(temp1, temp2)) { for (int i = 0; i < an2.size(); i++) { an1.push_back(an2[i]); } } } } return an1; }

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

longesttrip.cpp: In function 'std::vector<int> longest_trip(int, int)':
longesttrip.cpp:72:35: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   72 |                 for (int i = 0; i < an2.size(); 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...