제출 #123962

#제출 시각아이디문제언어결과실행 시간메모리
123962sebinkimMeetings (JOI19_meetings)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "meetings.h" using namespace std; typedef pair <int, int> pii; void f(int p, vector <int> &V) { vector <int> X; vector <pii> Y; int i, j, v, q; swap(V[rand() % V.size()], V.back()); q = V.back(); V.pop_back(); for(int &t: V){ v = Query(p, q, t); if(t == v) X.push_back(t); else Y.emplace_back(v, t); } if(X.empty()) Bridge(p, q); else{ sort(X.begin(), X.end(), [&](int &a, int &b){ if(a == b) return 0; return Query(p, a, b) == a; }); Bridge(p, X[0]); for(i=1; i<X.size(); i++){ Bridge(X[i - 1], X[i]); } Bridge(X.back(), q); } sort(Y.begin(), Y.end()); for(i=0; i<Y.size(); i=j){ V.clear(); for(j=i; j<Y.size() && Y[j].first == Y[i].first; j++){ V.push_back(Y[j].second); } f(Y[i].first, V); } } void Solve(int n) { vector <int> V; int i; srand(time(0)); for(i=1; i<n; i++){ V.push_back(i); } f(0, V); }

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

meetings.cpp: In lambda function:
meetings.cpp:28:29: error: inconsistent types 'int' and 'bool' deduced for lambda return type
    return Query(p, a, b) == a;
                             ^
meetings.cpp: In function 'void f(int, std::vector<int>&)':
meetings.cpp:32:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(i=1; i<X.size(); i++){
            ~^~~~~~~~~
meetings.cpp:40:12: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(i=0; i<Y.size(); i=j){
           ~^~~~~~~~~
meetings.cpp:42:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(j=i; j<Y.size() && Y[j].first == Y[i].first; j++){
            ~^~~~~~~~~