Submission #232704

# Submission time Handle Problem Language Result Execution time Memory
232704 2020-05-17T22:15:47 Z UserIsUndefined Split the Attractions (IOI19_split) C++14
0 / 100
7 ms 2688 KB
#include <bits/stdc++.h>
//#include "split.h"

using namespace std;


vector<int> adj[100005];
int ok;
map<int,int> visited;

map<int,int> good;
int sz;
int now;

void dfs(int v){
    visited[v] = true;
    sz--;
    good[v] = now;
    if (sz == 0) return;

    for (int i : adj[v]){
        if (visited[i] == false){
            dfs(i);
        }
    }

}




vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) {
	vector<int> res(n, 0);


    for (int i = 0 ; i < p.size() ; i++){
        int x = p[i];
        int y = q[i];
        adj[x].push_back(y);
        adj[y].push_back(x);
    }


    sz = a;
    now = 1;

    dfs(0);

    sz = b;
    now = 2;

    for (int i = 0 ; i < n ; i++){
        if (visited[i] == 0)dfs(i);
    }

    for (int i = 0 ; i < n ; i++){
        res[i] = (good[i] == 0 ? 3 : good[i]);
    }


    return res;



}

Compilation message

split.cpp: In function 'std::vector<int> find_split(int, int, int, int, std::vector<int>, std::vector<int>)':
split.cpp:36:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0 ; i < p.size() ; i++){
                      ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 2688 KB invalid split: #1=1, #2=2, #3=0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 2688 KB invalid split: #1=1, #2=2, #3=0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 2688 KB invalid split: #1=5, #2=0, #3=0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 2688 KB invalid split: #1=9, #2=0, #3=0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 2688 KB invalid split: #1=1, #2=2, #3=0
2 Halted 0 ms 0 KB -