Submission #986584

# Submission time Handle Problem Language Result Execution time Memory
986584 2024-05-20T20:24:33 Z mariaclara Split the Attractions (IOI19_split) C++17
0 / 100
56 ms 12800 KB
#include "split.h"
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
#define all(x) x.begin(), x.end()
#define sz(x) x.size()
#define mk make_pair
#define pb push_back
#define fr first
#define sc second

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

	for(int i = 0; i < sz(p); i++)
		edges[p[i]].pb(q[i]), edges[q[i]].pb(p[i]);

	if(a == 1) {
		queue<int> fila;
		vector<int> ans(n);
		fila.push(0);

		int cnt = 0;
		while(!fila.empty()) {
			int x = fila.front();
			fila.pop();

			ans[x] = 2;
			cnt++;
			if(cnt == b) break;

			for(int viz : edges[x])
				if(!ans[viz]) fila.push(viz);
		}

		for(int i = 0; i < n; i++)
			if(a and ans[i] == 0) ans[i] = 1, a = 0;
			else if(ans[i] == 0) ans[i] = 3;
		
		return ans;
	}
}

Compilation message

split.cpp: In function 'std::vector<int> find_split(int, int, int, int, std::vector<int>, std::vector<int>)':
split.cpp:18:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |  for(int i = 0; i < sz(p); i++)
      |                   ^
split.cpp:16:29: warning: control reaches end of non-void function [-Wreturn-type]
   16 |  vector<vector<int>> edges(n);
      |                             ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB ok, correct split
2 Correct 0 ms 600 KB ok, correct split
3 Correct 0 ms 348 KB ok, correct split
4 Runtime error 2 ms 604 KB Execution killed with signal 6
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB ok, correct split
2 Correct 0 ms 348 KB ok, correct split
3 Correct 0 ms 348 KB ok, correct split
4 Correct 44 ms 10484 KB ok, correct split
5 Correct 39 ms 9040 KB ok, correct split
6 Correct 34 ms 8796 KB ok, correct split
7 Correct 36 ms 8784 KB ok, correct split
8 Incorrect 56 ms 12800 KB invalid split: #1=1, #2=8004, #3=91995
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 604 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 604 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB ok, correct split
2 Correct 0 ms 600 KB ok, correct split
3 Correct 0 ms 348 KB ok, correct split
4 Runtime error 2 ms 604 KB Execution killed with signal 6
5 Halted 0 ms 0 KB -