Submission #153124

# Submission time Handle Problem Language Result Execution time Memory
153124 2019-09-12T14:10:43 Z errorgorn Split the Attractions (IOI19_split) C++14
11 / 100
123 ms 12688 KB
#include "split.h"
#include <cstdio>
#include <vector>
using namespace std;
vector<int> al[100005];
int color,num;
vector<int> res;
void dfs(int i){
    res[i]=color;
    num--;
    if (!num) return;
    for (vector<int>::iterator it=al[i].begin();it!=al[i].end();it++){
        if (!res[*it]) dfs(*it);
        if (!num) return;
    }
}
vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) {
    res=vector<int> (n,0);
	for (int x=0;x<p.size();x++){
        al[p[x]].push_back(q[x]);
        al[q[x]].push_back(p[x]);
	}
    if (a==1){
        if (b>c) num=c,color=3;
        else num=b,color=2;
        dfs(0);
        color=(color==2)?3:2;
        bool lone=true;
        for (int x=0;x<n;x++){
            if (!res[x]){
                if (lone){
                    lone=false;
                    res[x]=1;
                }
                else{
                    res[x]=color;
                }
            }
        }
    }
    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:19:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int x=0;x<p.size();x++){
               ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 4 ms 2680 KB ok, correct split
2 Correct 4 ms 2728 KB ok, correct split
3 Correct 4 ms 2680 KB ok, correct split
4 Incorrect 5 ms 2680 KB jury found a solution, contestant did not
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 2680 KB ok, correct split
2 Correct 4 ms 2680 KB ok, correct split
3 Correct 4 ms 2680 KB ok, correct split
4 Correct 99 ms 11028 KB ok, correct split
5 Correct 83 ms 9336 KB ok, correct split
6 Correct 84 ms 9428 KB ok, correct split
7 Correct 84 ms 10872 KB ok, correct split
8 Correct 123 ms 12688 KB ok, correct split
9 Correct 78 ms 9336 KB ok, correct split
10 Correct 63 ms 9328 KB ok, correct split
11 Correct 66 ms 9316 KB ok, correct split
12 Correct 68 ms 9712 KB ok, correct split
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 2680 KB jury found a solution, contestant did not
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 2680 KB jury found a solution, contestant did not
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 2680 KB ok, correct split
2 Correct 4 ms 2728 KB ok, correct split
3 Correct 4 ms 2680 KB ok, correct split
4 Incorrect 5 ms 2680 KB jury found a solution, contestant did not
5 Halted 0 ms 0 KB -