답안 #443149

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
443149 2021-07-09T19:53:47 Z Dipto_Debdip Drvca (COCI19_drvca) C++14
20 / 110
96 ms 8124 KB
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
bool chk(vector<ll> v) {
  set<ll> st;
  for (ll i = 0; i < (ll) (v.size()) - 1; i++) {
    st.insert(v[i] - v[i + 1]);
  }
  return (st.size() == 1 || st.size() == 0);
}
int main(int argc, char const *argv[]) {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll n, k;
  cin >> n;
  vector<ll> v;
  for (ll i = 0; i < n; i++) cin >> k, v.push_back(k);
  sort(v.begin(), v.end());
  for (ll i = 0; i < (1 << n); i++) {
    vector<ll> ano;
    map<ll, ll> mp;
    for (ll j = 0; j < n; j++) {
      if (i & (1 << j)) ano.push_back(v[j]), mp[j]++;
    }
    vector<ll> anoo;
    for (ll j = 0; j < n; j++) if (!mp[j]) anoo.push_back(v[j]);
    if (anoo.size() && ano.size() && chk(ano) && chk(anoo)) {
      cout << ano.size() << endl;
      for (ll j : ano) cout << j << " ";
      cout << endl;
      cout << anoo.size() << endl;
      for (ll j : anoo) cout << j << " ";
      cout << endl;
      return 0;
    }
  }
  cout << -1 << endl;
  return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 204 KB Output is correct
2 Correct 29 ms 204 KB Output is correct
3 Correct 20 ms 312 KB Output is correct
4 Correct 57 ms 204 KB Output is correct
5 Correct 2 ms 204 KB Output is correct
6 Correct 28 ms 204 KB Output is correct
7 Correct 5 ms 316 KB Output is correct
8 Correct 57 ms 288 KB Output is correct
9 Correct 2 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 204 KB Output is correct
2 Correct 29 ms 204 KB Output is correct
3 Correct 20 ms 312 KB Output is correct
4 Correct 57 ms 204 KB Output is correct
5 Correct 2 ms 204 KB Output is correct
6 Correct 28 ms 204 KB Output is correct
7 Correct 5 ms 316 KB Output is correct
8 Correct 57 ms 288 KB Output is correct
9 Correct 2 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Incorrect 96 ms 344 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 43 ms 8124 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 204 KB Output is correct
2 Correct 29 ms 204 KB Output is correct
3 Correct 20 ms 312 KB Output is correct
4 Correct 57 ms 204 KB Output is correct
5 Correct 2 ms 204 KB Output is correct
6 Correct 28 ms 204 KB Output is correct
7 Correct 5 ms 316 KB Output is correct
8 Correct 57 ms 288 KB Output is correct
9 Correct 2 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Incorrect 96 ms 344 KB Output isn't correct
16 Halted 0 ms 0 KB -