This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// "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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |