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 "grader.cpp"
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define OK puts("OK");
#define NO puts("NO");
#define YES puts("YES");
#define fr first
#define sc second
#define ret return
#define all(s) s.begin(),s.end()
#define allr(s) s.rbegin(),s.rend()
#define pb push_back
#define sz(v) (int)v.size()
#define endi puts("");
using namespace std;
bool vis[2001],voobshe[2001];
set <int> g[2001];
void Solve(int N) {
int x ,i,j,y=1;
map <pair<pii,int> ,int> mp;
/// krasava -_0
x=0;
for (i=1;i<N;++i){
int cnt=g[x].size();
for (int to : g[x]){
if (to == x || to == i || i == x)continue;
int a = x,b = to,c = i,s;
if (a > b)swap(a,b);
if (b > c)swap(c,b);
if (a > b)swap(a,b);
if (b > c)swap(c,b);
if (a > b)swap(a,b);
if (b > c)swap(c,b);
if (a > b)swap(a,b);
if (b > c)swap(c,b);
if (mp.count({{a,b},c}) > 0){
s = mp[{{a,b},c}];
}
else {
s = Query(x,to,i);
}
{
int mass[3];
mass[0]=s;
mass[1]=b;
mass[2]=c;
sort(mass,mass+3);
mp[{{mass[0],mass[1]},mass[2]}] = s;
}
{
int mass[3];
mass[0]=a;
mass[1]=s;
mass[2]=c;
sort(mass,mass+3);
mp[{{mass[0],mass[1]},mass[2]}] = s;
}
{
int mass[3];
mass[0]=a;
mass[1]=b;
mass[2]=s;
sort(mass,mass+3);
mp[{{mass[0],mass[1]},mass[2]}] = s;
}
if (s == x){
cnt--;
continue;
}
if (s == to){
x = s;
i--;
break;
}
else if (s == i){
g[x].erase(to);
g[to].erase(x);
g[x].insert(i);
g[to].insert(i);
g[i].insert(to);
g[i].insert(x);
break;
}
else {
g[x].erase(to);
g[to].erase(x);
g[x].insert(s);
g[to].insert(s);
g[i].insert(s);
g[s].insert(i);
g[s].insert(to);
g[s].insert(x);
x=s;
break;
}
cnt--;
}
if (cnt == 0){
g[x].insert(i);
g[i].insert(x);
}
}
// for (i=0;i<N;++i){
// cout <<i<<"- ";
// for (int to : g[i]){
// cout <<to<<" ";
// }
// endi;
// }
for (i=0;i<N;++i){
for (int to : g[i]){
if (i < to){
Bridge(i,to);
}
}
}
}
Compilation message (stderr)
meetings.cpp: In function 'void Solve(int)':
meetings.cpp:22:14: warning: unused variable 'j' [-Wunused-variable]
22 | int x ,i,j,y=1;
| ^
meetings.cpp:22:16: warning: unused variable 'y' [-Wunused-variable]
22 | int x ,i,j,y=1;
| ^
# | 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... |