Submission #290579

# Submission time Handle Problem Language Result Execution time Memory
290579 2020-09-04T05:04:56 Z Pichon5 Split the Attractions (IOI19_split) C++17
0 / 100
75 ms 8196 KB
#include "split.h"
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
vector<vector<int> >G;
vector<int>res;
int aux=0;
int cc=1;
void dfs(int nodo,int x,int padre){
    if(aux==x){
        return;
    }
    res[nodo]=cc;
    aux++;
    for(int i=0;i<G[nodo].size();i++){
        if(G[nodo][i]!=padre){
            dfs(G[nodo][i],x,nodo);
        }
    }
}
vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) {
    G.assign(n,vector<int>());
	for(int i=0;i<p.size();i++){
        G[p[i]].pb(q[i]);
        G[q[i]].pb(p[i]);
	}
	res.assign(n,3);
	for(int i=0;i<n;i++){
        if(G[i].size()==1 && cc==1){
            dfs(i,a,-1);
            aux=0;
            cc++;
            continue;
        }
        if(G[i].size()==1 && cc==2){
            dfs(i,b,-1);
            break;
        }
	}
	return res;
}

Compilation message

split.cpp: In function 'void dfs(int, int, int)':
split.cpp:15:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |     for(int i=0;i<G[nodo].size();i++){
      |                 ~^~~~~~~~~~~~~~~
split.cpp: In function 'std::vector<int> find_split(int, int, int, int, std::vector<int>, std::vector<int>)':
split.cpp:23:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |  for(int i=0;i<p.size();i++){
      |              ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB ok, correct split
2 Incorrect 1 ms 256 KB invalid split: #1=0, #2=0, #3=3
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB ok, correct split
2 Incorrect 0 ms 256 KB invalid split: #1=0, #2=0, #3=3
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB ok, correct split
2 Incorrect 75 ms 8196 KB invalid split: #1=6364, #2=40000, #3=53636
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB invalid split: #1=3, #2=2, #3=4
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB ok, correct split
2 Incorrect 1 ms 256 KB invalid split: #1=0, #2=0, #3=3
3 Halted 0 ms 0 KB -