Submission #986585

# Submission time Handle Problem Language Result Execution time Memory
986585 2024-05-20T20:26:42 Z mariaclara Split the Attractions (IOI19_split) C++17
11 / 100
60 ms 12576 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) (int)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();

			if(ans[x]) continue;
			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: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 1 ms 344 KB ok, correct split
3 Correct 0 ms 344 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 1 ms 348 KB ok, correct split
2 Correct 1 ms 360 KB ok, correct split
3 Correct 0 ms 348 KB ok, correct split
4 Correct 48 ms 10580 KB ok, correct split
5 Correct 39 ms 9180 KB ok, correct split
6 Correct 36 ms 8784 KB ok, correct split
7 Correct 38 ms 9020 KB ok, correct split
8 Correct 60 ms 12576 KB ok, correct split
9 Correct 38 ms 8112 KB ok, correct split
10 Correct 34 ms 9260 KB ok, correct split
11 Correct 36 ms 9428 KB ok, correct split
12 Correct 35 ms 9684 KB ok, correct split
# 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 1 ms 344 KB ok, correct split
3 Correct 0 ms 344 KB ok, correct split
4 Runtime error 2 ms 604 KB Execution killed with signal 6
5 Halted 0 ms 0 KB -