# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
300775 | nadidadit | Connecting Supertrees (IOI20_supertrees) | C++17 | 1 ms | 384 KiB |
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"
#include <bits/stdc++.h>
#define fi first
#define se second
#define eb emplace_back
#define all(v) (v).begin(), (v).end()
#define rmin(r, x) r = min(r, x)
#define rmax(r, x) r = max(r, x)
#define ends ' '
#define endl '\n'
#define fastio ios_base::sync_with_stdio(0), cin.tie(0)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int maxn = 1e3 + 10;
int n;
vector<vector<int>> b;
int construct(vector<std::vector<int>> p) {
n = p.size();
b.resize(n);
for(int i = 0; i < n; ++i) b[i].resize(n);
int adit[n];
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
b[i][j]=0;
adit[i]=0;
}
}
int count=0,past;
for(int i=0;i<n;i++)
{
past=i;
for(int j=0;j<n;j++)
{
if(i!=j && p[i][j]==1)
{
if((adit[i]==0 && adit[j]==0))
{
b[past][j]=1;
b[j][past]=1;
adit[j]=1;
adit[past]=1;
past=j;
}
else if(adit[i]==1 && adit[j]==1)
{
}
else
{
return 0;
}
}
adit[i]=1;
}
}
build(b);
return 1;
}
Compilation message (stderr)
# | 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... |