This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "meetings.h"
#include <bits/stdc++.h>
#define pb push_back
#define all(x) x.begin(), x.end()
using namespace std;
int st, fin;
bool comp(int a, int b){
if(a==st||b==fin)return 1;
if(a==fin||b==st)return 0;
return Query(st, a, b)==a;
}
unordered_map<int, vector<int> > ump;
void solve(vector<int> vc){
if(vc.size()<=1)return;
ump[vc[0]].pb(vc[0]);
ump[vc[1]].pb(vc[1]);
vector<int> path;
path.pb(vc[0]);
for(int i=2; i<vc.size(); i++){
int x=Query(vc[0], vc[1], vc[i]);
if(ump[x].empty())path.pb(x);
ump[x].pb(vc[i]);
}
path.pb(vc[1]);
st=vc[0], fin=vc[1];
sort(all(path), comp);
for(int i=0; i<path.size()-1; i++){
//printf("%d - %d\n", path[i], path[i+1]);
Bridge(min(path[i], path[i+1]), max(path[i], path[i+1]));
}
for(int i=0; i<path.size(); i++){
vector<int> temp=ump[path[i]];
ump[path[i]].clear();
solve(temp);
}
}
void Solve(int n){
vector<int> temp;
for(int i=0; i<n; i++)temp.pb(i);
solve(temp);
}
Compilation message (stderr)
meetings.cpp: In function 'void solve(std::vector<int>)':
meetings.cpp:19:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=2; i<vc.size(); i++){
~^~~~~~~~~~
meetings.cpp:27:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=0; i<path.size()-1; i++){
~^~~~~~~~~~~~~~
meetings.cpp:31:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=0; i<path.size(); i++){
~^~~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |