| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1332730 | activedeltorre | 늑대인간 (IOI18_werewolf) | C++20 | 300 ms | 9984 KiB |
#include "werewolf.h"
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
//#include "werewolf.h"
using namespace std;
int sef[3005];
int cnt[3005];
int sz[3005];
int x[3005];
int y[3005];
int find(int a)
{
if(sef[a]==a)
{
return a;
}
return sef[a]=find(sef[a]);
}
void merge(int a,int b)
{
a=find(a);
b=find(b);
sef[b]=a;
}
std::vector<int> check_validity(int N, std::vector<int> X, std::vector<int> Y,
std::vector<int> S, std::vector<int> E,
std::vector<int> L, std::vector<int> R) {
int n=N,dim;
int m=X.size();
int q=S.size();
vector<int>rasp;
for(int i=0;i<m;i++)
{
x[i]=X[i];
y[i]=Y[i];
if(X[i]>Y[i])
{
swap(x[i],y[i]);
}
}
for(int i=0;i<q;i++)
{
int dim=0;
for(int j=0;j<n;j++)
{
sef[j]=j;
cnt[j]=0;
}
for(int j=0;j<m;j++)
{
if(x[j]<L[i])
{
continue;
}
merge(x[j],y[j]);
}
for(int j=L[i];j<=R[i];j++)
{
if(find(j)==find(S[i]))
{
cnt[j]=1;
}
}
for(int j=0;j<n;j++)
{
sef[j]=j;
}
for(int j=0;j<m;j++)
{
if(y[j]>R[i])
{
continue;
}
merge(x[j],y[j]);
}
for(int j=L[i];j<=R[i];j++)
{
if(find(j)==find(E[i]))
{
if(cnt[j]==1)
{
dim=1;
}
}
cnt[j]=0;
}
if(dim==0)
{
rasp.push_back(0);
}
else
{
rasp.push_back(1);
}
}
return rasp;
}| # | 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... | ||||
