Submission #147470

# Submission time Handle Problem Language Result Execution time Memory
147470 2019-08-29T15:47:02 Z mosiashvililuka Split the Attractions (IOI19_split) C++14
0 / 100
116 ms 14264 KB
#include<bits/stdc++.h>
using namespace std;
int z,x,d,e,ka[10],zx,m,la[100009];
vector <int> pas,v[100009];
bool bo[100009];
void dfs(int w){
	if(ka[zx]==0) return;
	bo[w]=1;
	pas[w]=zx;
	ka[zx]--;
	if(ka[zx]==0) return;
	for(vector <int>::iterator it=v[w].begin(); it!=v[w].end(); it++){
		if(bo[(*it)]==1) continue;
		dfs((*it));
		if(ka[zx]==0) return;
	}
}
vector <int> find_split(int n, int a, int b, int c, vector <int> p, vector <int> q){
	pas.resize(n);
	ka[1]=a;
	ka[2]=b;
	ka[3]=c;
	zx=0;
	m=p.size();
	for(int h=0; h<m; h++){
		v[p[h]].push_back(q[h]);
		v[q[h]].push_back(p[h]);
	}
	for(int h=0; h<n; h++) la[h]=h;
	zx=-1;
	for(int h=0; h<n; h++){
		if(v[h].size()==1){
			zx++;
			swap(la[zx],la[h]);
		}
	}
	zx=0;
	for(int h=0; h<n; h++){
		if(bo[la[h]]==0){
			zx++;
			dfs(la[h]);
		}
	}
	return pas;
}
# 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 2712 KB ok, correct split
4 Correct 4 ms 2808 KB ok, correct split
5 Incorrect 4 ms 2680 KB answer for 3-th vertex does not belong to {0, 1, 2, 3}
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 2680 KB ok, correct split
2 Correct 5 ms 2680 KB ok, correct split
3 Correct 4 ms 2680 KB ok, correct split
4 Correct 116 ms 12964 KB ok, correct split
5 Runtime error 95 ms 14264 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 2680 KB answer contains both zero and positive values
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 2716 KB answer contains both zero and positive values
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 2680 KB ok, correct split
3 Correct 4 ms 2712 KB ok, correct split
4 Correct 4 ms 2808 KB ok, correct split
5 Incorrect 4 ms 2680 KB answer for 3-th vertex does not belong to {0, 1, 2, 3}
6 Halted 0 ms 0 KB -