Submission #288966

# Submission time Handle Problem Language Result Execution time Memory
288966 2020-09-02T08:40:10 Z mohammad Split the Attractions (IOI19_split) C++14
0 / 100
111 ms 14448 KB
#include "split.h"
#include<bits/stdc++.h>
using namespace std;
 
#define endl "\n"
// #define int long long

typedef long long ll ;
const ll ooo = 1e14 ;
const ll oo = 2e9 ;
const double PI = acos(-1) ;
const ll M = 1e9 + 7  ;
const int N = 10000010  ;

int use[200010];
vector<int> v[200010] , seq;

void dfs(int u ){
	seq.push_back(u);
	use[u] = 1;
	for(auto x : v[u])
		if(!use[x]){
			dfs(x);
		}
}

vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) {
	vector<int> res;
	int m = p.size();
	for(int i = 0 ;  i < m ; ++i) {
		v[p[i]].push_back(q[i]);
		v[q[i]].push_back(p[i]);
	}
	dfs(0);
	if(b > c){
		res = vector<int>(n , 2);
		for(int i = 0 ; i < c ; ++i) res[seq[i]] = 3;
		for(int i = 0 ; i < n ; ++i) if(res[i] == 2){
			res[i] = 1;
			break;
		}
	}else{
		res = vector<int>(n , 3);
		for(int i = 0 ; i < c ; ++i) res[seq[i]] = 2;
		for(int i = 0 ; i < n ; ++i) if(res[i] == 3){
			res[i] = 1;
			break;
		}
	}
	return res;
}
# Verdict Execution time Memory Grader output
1 Correct 4 ms 4992 KB ok, correct split
2 Correct 3 ms 4992 KB ok, correct split
3 Incorrect 4 ms 5024 KB invalid split: #1=1, #2=2, #3=1
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4992 KB ok, correct split
2 Correct 3 ms 4992 KB ok, correct split
3 Correct 4 ms 4992 KB ok, correct split
4 Incorrect 111 ms 14448 KB invalid split: #1=1, #2=99998, #3=1
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 4992 KB invalid split: #1=1, #2=2, #3=2
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 5060 KB invalid split: #1=1, #2=3, #3=5
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 4992 KB ok, correct split
2 Correct 3 ms 4992 KB ok, correct split
3 Incorrect 4 ms 5024 KB invalid split: #1=1, #2=2, #3=1
4 Halted 0 ms 0 KB -