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"
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2")
#include <bits/stdc++.h>
#define MEM 222222
#define sanic ios_base::sync_with_stdio(0)
#define x first
#define y second
#define pf push_front
#define pb push_back
#define all(v) v.begin(), v.end()
#define sz size()
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pi;
const ll INF = 2e18;
const ll MOD = 998244353;
ll r[MEM];
int construct(vector<vector<int>> p) {
int n = p.size();
vector<vector<int>> ans(n, vector<int>(n, 0));
for(int i=0; i<n; i++)
for(int j=0; j<n; j++)
if(p[i][j]>2) return 0;
for(int i=0; i<n; i++){
ll pp=0;
while(p[i][pp]!=1) pp++;
if(i==pp){
r[i] = 1;
continue;
}
if(p[i]!=p[pp]) return 0;
ans[i][pp] = ans[pp][i] = 1;
}
for(int i=0; i<n; i++){
if(!r[i]) continue;
ll pp=0;
while(p[i][pp]==0) pp++;
for(int j=0; j<n; j++)
if((!p[pp][j] && p[i][j])||(p[pp][j] && !p[i][j])) return 0;
if(pp!=i) continue;
ll pos=i;
for(int j=0; j<n; j++)
if(r[j] && p[i][j]) {
ans[j][pos] = ans[pos][j] = 1;
pos = j;
}
if(ans[pos][i]) return 0;
else{
if(pos==i) continue;
ans[i][pos] = ans[pos][i] = 1;
}
}
build(ans);
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... |