이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 2222
#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[pos][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... |