이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "meetings.h"
#include <vector>
#include <set>
#include <utility>
#include <stdio.h>
using namespace std;
int how[2005][2005];
int con[2005];
set < int > have;
set < int > tt;
vector < pair < int , int > > road;
void Solve(int N)
{
int t,i,x,y;
for(i=0;i<N;i++) have.insert(i);
while(have.size()>2)
{
for(auto i:have)
{
//Next[i].clear();
for(auto j:have) how[i][j]=0;
}
for(auto i:have)
{
for(auto j:have)
{
for(auto k:have)
{
if(k>j&&j>i)
{
t=Query(i,j,k);
//printf("%d %d %d %d\n",i,j,k,t);
if(t==i)
{
con[i]++;
how[j][i]++;
how[k][i]++;
}
if(t==j)
{
con[j]++;
how[i][j]++;
how[k][j]++;
}
if(t==k)
{
con[k]++;
how[i][k]++;
how[j][k]++;
}
}
}
}
}
for(auto i:have)
{
if(con[i]==0)
{
x=0;
y=0;
for(auto j:have)
{
x=max(x,how[i][j]);
if(x==how[i][j]) y=j;
}
road.push_back(make_pair(i,y));
tt.insert(i);
}
}
for(auto i:tt) have.erase(i);
tt.clear();
}
//for(auto i:have) printf("aa %d\n",i);
//printf("%d\n",have.size());
if(have.size()==2)
{
//printf("aaa %d %d\n",*have.begin(),*(prev(have.end())));
road.push_back(make_pair(*have.begin(),*(prev(have.end()))));
}
//printf("%d\n",road.size());
for(auto i:road)
{
//printf("%d %d\n",min(i.first,i.second),max(i.first,i.second));
Bridge(min(i.first,i.second),max(i.first,i.second));
}
}
# | 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... |