제출 #391813

#제출 시각아이디문제언어결과실행 시간메모리
391813Pichon5Split the Attractions (IOI19_split)C++17
11 / 100
105 ms12576 KiB
#include "split.h"
#include<bits/stdc++.h>
#define lcm(a,b) (a/__gcd(a,b))*b
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define pb push_back
#define F first
#define S second
#define mp make_pair
using namespace std;
vector<vi>G;
vi res;
int cant=0;
int B;
void dfs(int nodo){
    if(cant>=B)return;
    res[nodo]=2;
    cant++;
    for(auto it : G[nodo]){
        if(res[it]==2)continue;
        dfs(it);
    }
}
vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) {
    int m=p.size();
    G.assign(n,vi());
    for(int i=0;i<m;i++){
        G[p[i]].pb(q[i]);
        G[q[i]].pb(p[i]);
    }
    res.assign(n,3);
    B=b;
    dfs(0);

    for(int i=0;i<n;i++){
        if(res[i]==3){
            res[i]=1;
            break;
        }
    }
	return res;
}

#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...