제출 #230098

#제출 시각아이디문제언어결과실행 시간메모리
230098PeppaPigMeetings (JOI19_meetings)C++14
29 / 100
2343 ms1400 KiB
#include "meetings.h" #include <bits/stdc++.h> #define pii pair<int, int> #define x first #define y second using namespace std; const int N = 2e3+5; void connect(int a, int b) { if(a > b) swap(a, b); Bridge(a, b); } void solve(vector<int> &vec) { if(vec.size() <= 2) { if(vec.size() == 2) connect(vec[0], vec[1]); return; } int a = vec[0], b = vec[1]; map<int, vector<int> > mp; for(int i = 2; i < vec.size(); i++) { int now = Query(a, b, vec[i]); mp[now].emplace_back(vec[i]); } vector<int> path; for(auto p : mp) { if(p.x == a) p.y.emplace_back(a); else if(p.x == b) p.y.emplace_back(b); else path.emplace_back(p.x); solve(p.y); } sort(path.begin(), path.end(), [&](int x, int y) { return Query(x, y, b) == y; }); if(!path.empty()) { connect(a, path[0]), connect(path.back(), b); for(int i = 0; i < path.size() - 1; i++) connect(path[i], path[i + 1]); } else connect(a, b); } void Solve(int n) { vector<int> vec; for(int i = 0; i < n; i++) vec.emplace_back(i); solve(vec); }

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

meetings.cpp: In function 'void solve(std::vector<int>&)':
meetings.cpp:24:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 2; i < vec.size(); i++) {
                    ~~^~~~~~~~~~~~
meetings.cpp:40:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int i = 0; i < path.size() - 1; i++) connect(path[i], path[i + 1]);
                        ~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...