제출 #472688

#제출 시각아이디문제언어결과실행 시간메모리
472688prvocisloMeetings (JOI19_meetings)C++17
100 / 100
1107 ms872 KiB
#include "meetings.h" #include <algorithm> #include <vector> #include <map> using namespace std; int x, y; bool cmp(int a, int b) { if (a == x) return true; if (b == x || a == b) return false; return Query(x, a, b) == a; } void solve(const vector<int>& v) { if (v.size() == 1) return; x = y = v[rand() % v.size()]; while (x == y) y = v[rand() % v.size()]; map<int, vector<int> > m; m[x].push_back(x); m[y].push_back(y); vector<int> path = { x, y }; for (int i : v) if (x != i && y != i) { int qi = Query(x, y, i); if (qi == i) path.push_back(i); m[qi].push_back(i); } sort(path.begin(), path.end(), cmp); for (int i = 0; i < path.size() - 1; i++) Bridge(min(path[i], path[i+1]), max(path[i], path[i + 1])); for (const pair<int, vector<int> >& i : m) solve(i.second); } void Solve(int N) { vector<int> path; for (int i = 0; i < N; i++) path.push_back(i); solve(path); }

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

meetings.cpp: In function 'void solve(const std::vector<int>&)':
meetings.cpp:30:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |  for (int i = 0; i < path.size() - 1; 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...