Submission #201559

#TimeUsernameProblemLanguageResultExecution timeMemory
201559RakhmandMeetings (JOI19_meetings)C++14
Compilation error
0 ms0 KiB
#include "meetings.h" #include <cstring> #include <list> #include <map> #include <deque> #include <stack> #include <bitset> #include <functional> #include <numeric> #include <sstream> #include <iostream> #include <iomanip> #include <queue> #include <cmath> #include <ctime> #include <cassert> #include <iterator> using namespace std; int n; int batya; vector<pair<int, int> > ans; bool cmp(int x, int y){ if(y == batya){ return 0; } if(x == batya){ return 1; } if(Query(batya, x, y) == x) return 1; else return 0; } void dfs(vector<int> v){ if(v.size() <= 1){ return ; } vector<int> path; vector<vector<int> > lol(n); int a = v[v.size() - 1]; int b = v[rand() % (v.size() - 1)]; path.push_back(a); path.push_back(b); for(int i = 0; i < v.size(); i++){ int x = v[i]; if(x == a || x == b) continue; int c = Query(a, b, x); if(c == x){ path.push_back(c); }else{ lol[c].push_back(x); } } batya = a; qsort(path.begin(), path.end(), cmp); for(int i = 1; i < path.size(); i++){ ans.push_back({path[i], path[i - 1]}); } for(int i = 0; i < v.size(); i++){ int x = v[i]; lol[x].push_back(x); dfs(lol[x]); } } void Solve(int N) { n = N; srand(time(NULL)); vector<int> v; for(int i = 0; i < N; i++) v.push_back(i); dfs(v); for(int i = 0; i < ans.size(); i++){ int x = ans[i].first, y = ans[i].second; if(x > y) swap(x, y); Bridge(x, y); } }

Compilation message (stderr)

meetings.cpp: In function 'void dfs(std::vector<int>)':
meetings.cpp:47:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 0; i < v.size(); i++){
                    ~~^~~~~~~~~~
meetings.cpp:58:40: error: cannot convert 'std::vector<int>::iterator {aka __gnu_cxx::__normal_iterator<int*, std::vector<int> >}' to 'void*' for argument '1' to 'void qsort(void*, size_t, size_t, __compar_fn_t)'
     qsort(path.begin(), path.end(), cmp);
                                        ^
meetings.cpp:59:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 1; i < path.size(); i++){
                    ~~^~~~~~~~~~~~~
meetings.cpp:62:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 0; i < v.size(); i++){
                    ~~^~~~~~~~~~
meetings.cpp: In function 'void Solve(int)':
meetings.cpp:75:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 0; i < ans.size(); i++){
                    ~~^~~~~~~~~~~~