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 "supertrees.h"
//Bismillahirrahmanirrahim
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#include <bits/stdc++.h>
using namespace std;
typedef long long lo;
typedef pair< lo,lo > PII;
#define fi first
#define se second
#define mp make_pair
#define endl "\n"
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=0;i<n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)
const lo inf = 1000000000000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 500005;
const lo mod = 1000000007;
int m,k,flag,t,vis[li];
int cev;
string s;
vector<int> v[li],vec[li];
int construct(std::vector<std::vector<int>> p) {
int n = p.size();
std::vector<std::vector<int>> a;
for (int i = 0; i < n; i++) {
for(int j=i;j<n;j++){
//~ if(i==j)continue;
if(p[i][j]!=0){v[i].pb(j);if(i!=j)v[j].pb(i);}
}
}
FOR sort(v[i].begin(),v[i].end());
int say=0;
FOR{
if(vis[i])continue;
vis[i]=++say;
for(int jj=0;jj<(int)v[i].size();jj++){
int go=v[i][jj];
vis[go]=say;
vec[say].pb(go);
if(v[go].size()!=v[i].size())return 0;
//~ cout<<i<<": : "<<go<<endl;
for(int ii=0;ii<(int)v[i].size();ii++){
//~ cout<<go<<" "<<i<<" ** "<<v[go][ii]<<" : : "<<v[i][ii]<<endl;
if(v[go][ii]!=v[i][ii])return 0;
}
}
}
FOR{
vector<int> vv;
int ind=0;
while(vec[vis[i]][ind]!=i)ind++;
//~ cout<<vec[vis[i]][ind+1]<<"**"<<endl;
for(int j=0;j<n;j++){
if((ind!=0 && j==vec[vis[i]][ind-1]) || (ind!=(int)vec[vis[i]].size() && j==vec[vis[i]][ind+1]))vv.pb(1);
else vv.pb(0);
}
a.pb(vv);
}
build(a);
return 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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |