제출 #126850

#제출 시각아이디문제언어결과실행 시간메모리
126850mohammedehab2002Meetings (JOI19_meetings)C++14
100 / 100
1460 ms3124 KiB
#include "meetings.h" #include <bits/stdc++.h> using namespace std; vector<int> ans[2005]; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); int lca(int u,int v) { if (!u || !v) return 0; if (u==v) return u; return Query(0,u,v); } bool cmp(int u,int v) { return (lca(u,v)==u); } void solve(vector<int> v) { if (v.size()==1) return; vector<int> l[2005],anc; int node=v[uniform_int_distribution<int>(0,v.size()-1)(rng)]; for (int u:v) { int tmp=lca(u,node); if (tmp==u) anc.push_back(u); l[tmp].push_back(u); } sort(anc.begin(),anc.end(),cmp); for (int i=0;i<anc.size()-1;i++) ans[anc[i]].push_back(anc[i+1]); for (int u:anc) solve(l[u]); } void Solve(int n) { vector<int> v; for (int i=0;i<n;i++) v.push_back(i); solve(v); for (int i=0;i<n;i++) { for (int u:ans[i]) Bridge(min(i,u),max(i,u)); } }

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

meetings.cpp: In function 'void solve(std::vector<int>)':
meetings.cpp:32:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i=0;i<anc.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...