#include "supertrees.h"
#include <bits/stdc++.h>
#define mp make_pair
#define f first
#define s second
#define sz(x) (int)(x).size()
#define rsz resize
#define ins insert
#define ft front()
#define bk back()
#define pf push_front
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
int res[1000][1000];
int construct(vector<vi> p)
{
int n=sz(p);
vi circle,line,group;
set<int>cir,lin,grp;
for (int i=0;i<n;i++)
{
for (int j=0;j<n;j++)
{
if (i==j)continue;
if (p[i][j]==2)
{
if (cir.count(i)==0)
{
cir.insert(i);
circle.pb(i);
}
if (cir.count(j)==0)
{
cir.insert(j);
circle.pb(j);
}
}
else if (p[i][j]==1)
{
if (lin.count(i)==0)
{
lin.insert(i);
line.pb(i);
}
if (lin.count(j)==0)
{
lin.insert(j);
line.pb(j);
}
}
else if (p[i][j]==0)
{
if (grp.count(i)==0)
{
grp.insert(i);
group.pb(i);
}
if (grp.count(j)==0)
{
grp.insert(j);
group.pb(j);
}
}
}
}
if (sz(circle)==0)
{
if (sz(group)==0)group.pb(0);
for (int k=0;k<sz(group);k++)
{
for (int i=0;i<n;i++)
{
if (group[k]==i)continue;
for (int j=0;j<n;j++)
{
if (p[group[k]][j]!=p[i][j])return 0;
}
res[group[k]][i]=1;
res[i][group[k]]=1;
}
}
}
vector<vi>answer;
for (int i=0;i<n;i++)
{
vi v;
for (int j=0;j<n;j++)
{
v.pb(res[i][j]);
}
answer.pb(v);
}
build(answer);
return 1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
13 ms |
2048 KB |
Output is correct |
7 |
Correct |
304 ms |
26204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
13 ms |
2048 KB |
Output is correct |
7 |
Correct |
304 ms |
26204 KB |
Output is correct |
8 |
Incorrect |
0 ms |
256 KB |
Answer gives possible 0 while actual possible 1 |
9 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
Answer gives possible 0 while actual possible 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
Answer gives possible 0 while actual possible 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
13 ms |
2048 KB |
Output is correct |
7 |
Correct |
304 ms |
26204 KB |
Output is correct |
8 |
Incorrect |
0 ms |
256 KB |
Answer gives possible 0 while actual possible 1 |
9 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
13 ms |
2048 KB |
Output is correct |
7 |
Correct |
304 ms |
26204 KB |
Output is correct |
8 |
Incorrect |
0 ms |
256 KB |
Answer gives possible 0 while actual possible 1 |
9 |
Halted |
0 ms |
0 KB |
- |