Submission #442939

# Submission time Handle Problem Language Result Execution time Memory
442939 2021-07-09T11:31:22 Z Wasif_Jamil Drvca (COCI19_drvca) C++14
0 / 110
51 ms 588 KB
// "Say:He is the Most Merciful,We have believed in him and upon him we have relied" [67:29]

#include<bits/stdc++.h>
using namespace std;

bool is(vector<int>&v){
	if((int)v.size() == 1)return 1;
	int d = abs(v[0] - v[1]);
	for(int i=0; i<(int)v.size()-1; i++){
		if((v[i+1] - v[i]) != d)return 0;
	}
	return 1;
}

int main(){
	int n; cin >> n;
	vector<int>v(n);
	for(int i=0; i<n; i++){
		cin >> v[i];
	}
	sort(v.begin(), v.end());
	for(int i=1; i<(1 << n)-1; i++){
		vector<int>a, b;
		for(int j=0; j<n; j++){
			if(i & (1 << j)){
				a.push_back(v[j]);
			}else {
				b.push_back(v[j]);
			}
		}
		if(is(a) and is(b)){
			cout << a.size() << '\n';
			for(int e:a)cout << e << ' ';
			cout << '\n';
			cout << (int)b.size() << '\n';
			for(int e:b)cout << e << ' ';
			cout << '\n';
			return 0;
		}
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 204 KB Output is correct
2 Incorrect 7 ms 204 KB Unexpected end of file - int32 expected
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 204 KB Output is correct
2 Incorrect 7 ms 204 KB Unexpected end of file - int32 expected
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 51 ms 588 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 204 KB Output is correct
2 Incorrect 7 ms 204 KB Unexpected end of file - int32 expected
3 Halted 0 ms 0 KB -