| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 598069 | yutabi | Split the Attractions (IOI19_split) | C++14 | 498 ms | 1048576 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "split.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
typedef pair <int,int> ii;
vector <int> ans(100005);
vector <int> fnl(100005);
int edge=-1;
int node1=-1;
int node2=-1;
int N;
int A,B,C;
vector <vector <ii> > graph(100005);
int DFS(int node, int par=-1)
{
int sum=1;
for(int i=0;i<graph[node].size();i++)
{
if(graph[node][i].first!=par)
{
int res=DFS(graph[node][i].first,node);
sum+=res;
ans[graph[node][i].second]=res;
if(res>=A && N-res>=B)
{
node1=graph[node][i].first;
node2=node;
edge=graph[node][i].second;
}
if(N-res>=A && res>=B)
{
node2=graph[node][i].first;
node1=node;
edge=graph[node][i].second;
}
}
}
return sum;
}
int k;
int u;
void DFS2(int node, int par, int cl)
{
fnl[node]=cl;
k++;
for(int i=0;k<u && i<graph[node].size();i++)
{
if(graph[node][i].first!=par)
{
DFS2(graph[node][i].first,node,cl);
}
}
}
vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q)
{
int small=a;
int mid=b;
int large=c;
int remap[]={1,2,3};
if(a>b)
{
swap(a,b);
swap(remap[0],remap[1]);
}
if(b>c)
{
swap(c,b);
swap(remap[2],remap[1]);
}
if(a>b)
{
swap(a,b);
swap(remap[0],remap[1]);
}
N=n;
A=a;
B=b;
C=c;
int m=p.size();
for(int i=0;i<m;i++)
{
graph[p[i]].pb(ii(q[i],i));
graph[q[i]].pb(ii(p[i],i));
}
DFS(0);
if(node1==-1)
{
return vector <int> (m,0);
}
fnl=vector <int> (n,remap[2]);
k=0;
u=A;
DFS2(node1,node2,remap[0]);
k=0;
u=B;
DFS2(node2,node1,remap[1]);
return fnl;
}
컴파일 시 표준 에러 (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... | ||||
