QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#349220#8332. Two in Oneucup-team987#AC ✓30ms4864kbC++2011.1kb2024-03-10 00:06:182024-03-10 00:06:18

Judging History

你现在查看的是最新测评结果

  • [2024-03-10 00:06:18]
  • 评测
  • 测评结果:AC
  • 用时:30ms
  • 内存:4864kb
  • [2024-03-10 00:06:18]
  • 提交

answer

/**
 * date   : 2024-03-10 01:06:07
 * author : Nyaan
 */

#define NDEBUG

using namespace std;

// intrinstic
#include <immintrin.h>

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cfenv>
#include <cfloat>
#include <chrono>
#include <cinttypes>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdarg>
#include <cstddef>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <initializer_list>
#include <iomanip>
#include <ios>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <streambuf>
#include <string>
#include <tuple>
#include <type_traits>
#include <typeinfo>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

// utility

namespace Nyaan {
using ll = long long;
using i64 = long long;
using u64 = unsigned long long;
using i128 = __int128_t;
using u128 = __uint128_t;

template <typename T>
using V = vector<T>;
template <typename T>
using VV = vector<vector<T>>;
using vi = vector<int>;
using vl = vector<long long>;
using vd = V<double>;
using vs = V<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<long long>>;
template <typename T>
using minpq = priority_queue<T, vector<T>, greater<T>>;

template <typename T, typename U>
struct P : pair<T, U> {
  template <typename... Args>
  P(Args... args) : pair<T, U>(args...) {}

  using pair<T, U>::first;
  using pair<T, U>::second;

  P &operator+=(const P &r) {
    first += r.first;
    second += r.second;
    return *this;
  }
  P &operator-=(const P &r) {
    first -= r.first;
    second -= r.second;
    return *this;
  }
  P &operator*=(const P &r) {
    first *= r.first;
    second *= r.second;
    return *this;
  }
  template <typename S>
  P &operator*=(const S &r) {
    first *= r, second *= r;
    return *this;
  }
  P operator+(const P &r) const { return P(*this) += r; }
  P operator-(const P &r) const { return P(*this) -= r; }
  P operator*(const P &r) const { return P(*this) *= r; }
  template <typename S>
  P operator*(const S &r) const {
    return P(*this) *= r;
  }
  P operator-() const { return P{-first, -second}; }
};

using pl = P<ll, ll>;
using pi = P<int, int>;
using vp = V<pl>;

constexpr int inf = 1001001001;
constexpr long long infLL = 4004004004004004004LL;

template <typename T>
int sz(const T &t) {
  return t.size();
}

template <typename T, typename U>
inline bool amin(T &x, U y) {
  return (y < x) ? (x = y, true) : false;
}
template <typename T, typename U>
inline bool amax(T &x, U y) {
  return (x < y) ? (x = y, true) : false;
}

template <typename T>
inline T Max(const vector<T> &v) {
  return *max_element(begin(v), end(v));
}
template <typename T>
inline T Min(const vector<T> &v) {
  return *min_element(begin(v), end(v));
}
template <typename T>
inline long long Sum(const vector<T> &v) {
  return accumulate(begin(v), end(v), 0LL);
}

template <typename T>
int lb(const vector<T> &v, const T &a) {
  return lower_bound(begin(v), end(v), a) - begin(v);
}
template <typename T>
int ub(const vector<T> &v, const T &a) {
  return upper_bound(begin(v), end(v), a) - begin(v);
}

constexpr long long TEN(int n) {
  long long ret = 1, x = 10;
  for (; n; x *= x, n >>= 1) ret *= (n & 1 ? x : 1);
  return ret;
}

template <typename T, typename U>
pair<T, U> mkp(const T &t, const U &u) {
  return make_pair(t, u);
}

template <typename T>
vector<T> mkrui(const vector<T> &v, bool rev = false) {
  vector<T> ret(v.size() + 1);
  if (rev) {
    for (int i = int(v.size()) - 1; i >= 0; i--) ret[i] = v[i] + ret[i + 1];
  } else {
    for (int i = 0; i < int(v.size()); i++) ret[i + 1] = ret[i] + v[i];
  }
  return ret;
};

template <typename T>
vector<T> mkuni(const vector<T> &v) {
  vector<T> ret(v);
  sort(ret.begin(), ret.end());
  ret.erase(unique(ret.begin(), ret.end()), ret.end());
  return ret;
}

template <typename F>
vector<int> mkord(int N, F f) {
  vector<int> ord(N);
  iota(begin(ord), end(ord), 0);
  sort(begin(ord), end(ord), f);
  return ord;
}

template <typename T>
vector<int> mkinv(vector<T> &v) {
  int max_val = *max_element(begin(v), end(v));
  vector<int> inv(max_val + 1, -1);
  for (int i = 0; i < (int)v.size(); i++) inv[v[i]] = i;
  return inv;
}

vector<int> mkiota(int n) {
  vector<int> ret(n);
  iota(begin(ret), end(ret), 0);
  return ret;
}

template <typename T>
T mkrev(const T &v) {
  T w{v};
  reverse(begin(w), end(w));
  return w;
}

template <typename T>
bool nxp(T &v) {
  return next_permutation(begin(v), end(v));
}

// 返り値の型は入力の T に依存
// i 要素目 : [0, a[i])
template <typename T>
vector<vector<T>> product(const vector<T> &a) {
  vector<vector<T>> ret;
  vector<T> v;
  auto dfs = [&](auto rc, int i) -> void {
    if (i == (int)a.size()) {
      ret.push_back(v);
      return;
    }
    for (int j = 0; j < a[i]; j++) v.push_back(j), rc(rc, i + 1), v.pop_back();
  };
  dfs(dfs, 0);
  return ret;
}

// F : function(void(T&)), mod を取る操作
// T : 整数型のときはオーバーフローに注意する
template <typename T>
T Power(T a, long long n, const T &I, const function<void(T &)> &f) {
  T res = I;
  for (; n; f(a = a * a), n >>= 1) {
    if (n & 1) f(res = res * a);
  }
  return res;
}
// T : 整数型のときはオーバーフローに注意する
template <typename T>
T Power(T a, long long n, const T &I = T{1}) {
  return Power(a, n, I, function<void(T &)>{[](T &) -> void {}});
}

template <typename T>
T Rev(const T &v) {
  T res = v;
  reverse(begin(res), end(res));
  return res;
}

template <typename T>
vector<T> Transpose(const vector<T> &v) {
  using U = typename T::value_type;
  int H = v.size(), W = v[0].size();
  vector res(W, T(H, U{}));
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      res[j][i] = v[i][j];
    }
  }
  return res;
}

template <typename T>
vector<T> Rotate(const vector<T> &v, int clockwise = true) {
  using U = typename T::value_type;
  int H = v.size(), W = v[0].size();
  vector res(W, T(H, U{}));
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (clockwise) {
        res[W - 1 - j][i] = v[i][j];
      } else {
        res[j][H - 1 - i] = v[i][j];
      }
    }
  }
  return res;
}

}  // namespace Nyaan


// bit operation

namespace Nyaan {
__attribute__((target("popcnt"))) inline int popcnt(const u64 &a) {
  return _mm_popcnt_u64(a);
}
inline int lsb(const u64 &a) { return a ? __builtin_ctzll(a) : 64; }
inline int ctz(const u64 &a) { return a ? __builtin_ctzll(a) : 64; }
inline int msb(const u64 &a) { return a ? 63 - __builtin_clzll(a) : -1; }
template <typename T>
inline int gbit(const T &a, int i) {
  return (a >> i) & 1;
}
template <typename T>
inline void sbit(T &a, int i, bool b) {
  if (gbit(a, i) != b) a ^= T(1) << i;
}
constexpr long long PW(int n) { return 1LL << n; }
constexpr long long MSK(int n) { return (1LL << n) - 1; }
}  // namespace Nyaan


// inout

namespace Nyaan {

template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << p.first << " " << p.second;
  return os;
}
template <typename T, typename U>
istream &operator>>(istream &is, pair<T, U> &p) {
  is >> p.first >> p.second;
  return is;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  int s = (int)v.size();
  for (int i = 0; i < s; i++) os << (i ? " " : "") << v[i];
  return os;
}
template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
  for (auto &x : v) is >> x;
  return is;
}

istream &operator>>(istream &is, __int128_t &x) {
  string S;
  is >> S;
  x = 0;
  int flag = 0;
  for (auto &c : S) {
    if (c == '-') {
      flag = true;
      continue;
    }
    x *= 10;
    x += c - '0';
  }
  if (flag) x = -x;
  return is;
}

istream &operator>>(istream &is, __uint128_t &x) {
  string S;
  is >> S;
  x = 0;
  for (auto &c : S) {
    x *= 10;
    x += c - '0';
  }
  return is;
}

ostream &operator<<(ostream &os, __int128_t x) {
  if (x == 0) return os << 0;
  if (x < 0) os << '-', x = -x;
  string S;
  while (x) S.push_back('0' + x % 10), x /= 10;
  reverse(begin(S), end(S));
  return os << S;
}
ostream &operator<<(ostream &os, __uint128_t x) {
  if (x == 0) return os << 0;
  string S;
  while (x) S.push_back('0' + x % 10), x /= 10;
  reverse(begin(S), end(S));
  return os << S;
}

void in() {}
template <typename T, class... U>
void in(T &t, U &...u) {
  cin >> t;
  in(u...);
}

void out() { cout << "\n"; }
template <typename T, class... U, char sep = ' '>
void out(const T &t, const U &...u) {
  cout << t;
  if (sizeof...(u)) cout << sep;
  out(u...);
}

struct IoSetupNya {
  IoSetupNya() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    cerr << fixed << setprecision(7);
  }
} iosetupnya;

}  // namespace Nyaan


// debug


#ifdef NyaanDebug
#define trc(...) (void(0))
#else
#define trc(...) (void(0))
#endif

#ifdef NyaanLocal
#define trc2(...) (void(0))
#else
#define trc2(...) (void(0))
#endif


// macro

#define each(x, v) for (auto&& x : v)
#define each2(x, y, v) for (auto&& [x, y] : v)
#define all(v) (v).begin(), (v).end()
#define rep(i, N) for (long long i = 0; i < (long long)(N); i++)
#define repr(i, N) for (long long i = (long long)(N)-1; i >= 0; i--)
#define rep1(i, N) for (long long i = 1; i <= (long long)(N); i++)
#define repr1(i, N) for (long long i = (N); (long long)(i) > 0; i--)
#define reg(i, a, b) for (long long i = (a); i < (b); i++)
#define regr(i, a, b) for (long long i = (b)-1; i >= (a); i--)
#define fi first
#define se second
#define ini(...)   \
  int __VA_ARGS__; \
  in(__VA_ARGS__)
#define inl(...)         \
  long long __VA_ARGS__; \
  in(__VA_ARGS__)
#define ins(...)      \
  string __VA_ARGS__; \
  in(__VA_ARGS__)
#define in2(s, t)                           \
  for (int i = 0; i < (int)s.size(); i++) { \
    in(s[i], t[i]);                         \
  }
#define in3(s, t, u)                        \
  for (int i = 0; i < (int)s.size(); i++) { \
    in(s[i], t[i], u[i]);                   \
  }
#define in4(s, t, u, v)                     \
  for (int i = 0; i < (int)s.size(); i++) { \
    in(s[i], t[i], u[i], v[i]);             \
  }
#define die(...)             \
  do {                       \
    Nyaan::out(__VA_ARGS__); \
    return;                  \
  } while (0)


namespace Nyaan {
void solve();
}
int main() { Nyaan::solve(); }


//

using namespace Nyaan;

void q() {
  inl(N);
  vl A(N);
  in(A);

  vi freq(N + 1);
  each(x, A) freq[x]++;

  sort(all(freq));
  reverse(all(freq));
  trc(freq);

  ll m0 = msb(freq[0]);
  ll m1 = msb(freq[1]);
  trc(m0, m1);

  if (freq[1] == 0) die(freq[0]);
  if (m0 == m1) die(PW(m0 + 1) - 1);
  if (gbit(freq[0], m1) == 1) die(freq[0] | (PW(m1 + 1) - 1));

  int i = m1;
  while (i != -1) {
    if (gbit(freq[0], i) and gbit(freq[1], i)) break;
    i--;
  }
  trc(i);
  if (i == -1) {
    out(freq[0] | freq[1]);
  } else {
    out(freq[0] | freq[1] | (PW(i + 1) - 1));
  }
}

void Nyaan::solve() {
  int t = 1;
  in(t);
  while (t--) q();
}

这程序好像有点Bug,我给组数据试试?

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3880kb

input:

1
7
1 2 3 4 3 2 1

output:

3

result:

ok 1 number(s): "3"

Test #2:

score: 0
Accepted
time: 0ms
memory: 3808kb

input:

1
9
1 1 1 1 1 2 2 2 2

output:

7

result:

ok 1 number(s): "7"

Test #3:

score: 0
Accepted
time: 19ms
memory: 3764kb

input:

50
10000
72 65 90 94 67 93 41 43 54 83 31 34 38 37 44 42 92 63 66 79 90 45 41 40 19 54 34 90 13 74 40 77 41 57 74 86 91 79 34 39 21 88 90 57 23 31 8 15 80 27 45 38 53 96 51 82 70 71 19 75 62 95 31 67 99 97 94 29 90 7 95 82 61 98 62 77 43 65 66 30 41 69 38 79 51 9 63 77 13 30 72 70 67 93 92 45 74 50 ...

output:

255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255

result:

ok 50 numbers

Test #4:

score: 0
Accepted
time: 27ms
memory: 3692kb

input:

79114
7
1 2 4 3 2 3 7
7
1 2 4 7 4 1 5
6
4 2 2 4 2 1
7
1 2 1 4 7 3 2
7
1 2 4 7 1 1 3
7
1 2 6 1 5 2 5
6
5 2 6 1 2 5
7
1 1 7 6 6 5 2
7
1 2 5 6 6 7 7
7
1 1 2 7 2 3 6
7
1 1 1 4 6 2 2
7
1 1 5 7 3 5 2
7
1 1 7 6 2 2 5
6
4 3 4 6 3 1
6
4 4 3 2 3 1
7
1 1 2 3 7 6 2
6
1 2 5 6 3 4
7
1 1 1 1 4 7 6
6
2 6 6 2 5 3
6
...

output:

3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
1
5
3
3
3
3
3
3
3
3
3
3
3
5
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
6
3
3
3
3
5
3
3
3
5
3
3
3
3
3
3
3
3
3
3
5
3
3
3
3
3
3
3
3
3
3
3
5
3
3
3
1
3
3
3
3
3
3
5
3
3
3
3
3
3
3
3
3
3
...

result:

ok 79114 numbers

Test #5:

score: 0
Accepted
time: 21ms
memory: 3592kb

input:

50000
10
6 3 8 5 4 6 3 5 3 9
10
10 4 3 10 4 5 2 7 8 10
10
10 6 2 2 4 9 7 3 3 4
10
1 2 9 7 5 2 1 2 10 1
10
2 8 2 3 7 8 3 5 10 5
10
5 6 10 2 7 3 5 10 5 4
10
3 4 4 2 2 1 1 8 5 10
10
3 3 3 8 5 7 3 6 7 9
10
10 6 5 3 2 8 10 9 9 4
10
5 8 6 2 10 5 8 8 10 7
10
5 8 2 10 2 2 9 5 4 2
10
7 6 4 7 5 9 2 2 1 7
10
7...

output:

3
3
3
3
3
3
3
6
3
3
6
3
3
3
6
3
3
3
3
6
3
3
3
3
3
3
3
3
6
3
6
3
3
3
6
3
6
3
7
3
3
6
3
3
3
6
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
6
3
3
3
3
3
3
3
3
3
5
3
3
7
3
3
3
3
3
3
6
3
3
3
6
3
3
3
7
3
6
3
3
3
3
3
3
3
6
3
3
5
3
3
6
7
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
7
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
6
3
7
3
3
3
3
3
3
6
3
...

result:

ok 50000 numbers

Test #6:

score: 0
Accepted
time: 22ms
memory: 3856kb

input:

50000
10
2 1 2 2 2 2 1 2 1 3
10
3 2 1 3 2 2 1 2 2 3
10
3 2 1 1 2 3 2 1 1 2
10
1 1 3 2 2 1 1 1 3 1
10
1 2 1 1 2 2 1 2 3 2
10
2 2 3 1 2 1 2 3 2 2
10
1 2 2 1 1 1 1 2 2 3
10
1 1 1 2 2 2 1 2 2 3
10
3 2 2 1 1 2 3 3 3 2
10
2 2 2 1 3 2 2 2 3 2
10
2 2 1 3 1 1 3 2 2 1
10
2 2 2 2 2 3 1 1 1 2
10
2 3 2 1 1 2 2 1...

output:

7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
9
7
7
7
7
7
7
7
7
7
7
9
7
7
7
7
7
9
7
7
7
7
7
7
9
9
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
9
7
7
7
7
7
9
7
10
7
7
7
7
7
7
10
7
7
7
7
7
7
7
7
7
7
7
7
7
10
7
7
7
7
7
7
7
7
7
7
7
7...

result:

ok 50000 numbers

Test #7:

score: 0
Accepted
time: 23ms
memory: 3888kb

input:

5000
100
35 13 56 51 37 39 100 35 21 36 54 19 99 74 38 99 90 69 29 23 38 27 40 94 92 93 93 45 94 22 65 65 43 62 47 53 11 77 87 15 77 72 3 38 25 19 4 82 48 69 15 13 8 76 48 8 19 86 25 26 34 70 38 42 87 81 31 92 30 24 80 69 8 74 48 30 57 47 65 42 35 47 42 85 18 94 97 13 8 24 100 31 51 72 69 95 74 90 9...

output:

7
7
3
7
7
7
7
7
7
7
7
7
7
3
7
7
7
7
7
7
7
7
3
7
7
3
7
7
7
7
3
7
7
7
7
7
7
3
7
7
3
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
3
7
7
7
3
7
7
7
7
7
3
7
7
7
3
7
7
7
3
7
7
7
7
3
7
7
3
7
7
7
7
7
7
7
7
7
7
3
7
7
7
7
7
7
7
7
7
7
3
7
7
3
3
7
7
7
7
7
7
7
7
7
7
7
7
3
3
7
7
7
7
3
7
7
7
7
7
7
7
7
7
7
7
3
7
...

result:

ok 5000 numbers

Test #8:

score: 0
Accepted
time: 16ms
memory: 3544kb

input:

5000
100
5 3 7 7 6 6 10 5 4 6 7 4 9 8 6 9 9 8 5 4 6 5 6 9 9 9 9 6 9 4 8 8 6 7 6 7 3 8 9 3 8 8 1 6 5 4 2 9 6 8 3 3 2 8 6 2 4 9 5 5 5 8 6 6 9 9 5 9 5 4 8 8 2 8 6 5 7 6 8 6 5 6 6 9 4 9 9 3 2 4 10 5 7 8 8 9 8 9 9 8
100
6 6 4 2 6 5 9 9 6 7 9 7 6 6 3 3 4 9 7 7 9 6 9 3 6 3 10 6 8 9 8 9 5 6 3 3 5 9 8 8 8 1 ...

output:

31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
...

result:

ok 5000 numbers

Test #9:

score: 0
Accepted
time: 21ms
memory: 3632kb

input:

500
1000
826 799 36 103 143 218 173 682 364 907 788 338 489 308 749 437 185 166 973 723 463 220 892 883 126 274 442 324 227 772 349 202 740 43 361 521 690 113 160 281 364 507 913 552 766 661 82 931 590 896 439 701 330 538 939 710 841 660 620 727 309 506 113 55 230 459 734 675 977 737 922 642 860 894...

output:

7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
...

result:

ok 500 numbers

Test #10:

score: 0
Accepted
time: 15ms
memory: 3664kb

input:

500
1000
28 28 6 10 11 14 13 26 19 30 28 18 22 17 27 20 13 12 31 26 21 14 29 29 11 16 21 18 15 27 18 14 27 6 19 22 26 10 12 16 19 22 30 23 27 25 9 30 24 29 20 26 18 23 30 26 29 25 24 26 17 22 10 7 15 21 27 25 31 27 30 25 29 29 25 24 9 10 16 24 29 23 19 16 28 21 28 12 31 10 20 18 11 21 14 11 14 12 19...

output:

63
63
127
127
63
127
125
63
127
127
127
126
127
63
63
63
127
127
127
127
63
127
126
127
127
127
127
127
127
63
127
127
127
63
127
127
123
127
63
127
63
119
127
63
125
127
127
63
127
127
123
126
127
127
63
127
125
127
127
119
127
127
119
127
127
63
63
127
63
63
127
127
127
63
122
63
127
127
127
63
63...

result:

ok 500 numbers

Test #11:

score: 0
Accepted
time: 23ms
memory: 3804kb

input:

50
10000
5231 4283 8159 8842 4592 8761 1749 1922 2947 6985 988 1176 1520 1420 2002 1812 8626 4019 4403 6360 8219 2027 1745 1619 395 2982 1182 8185 179 5604 1659 5959 1682 3355 5489 7484 8447 6328 1184 1555 477 7889 8272 3343 544 975 80 226 6518 729 2044 1450 2904 9281 2622 6742 4921 5143 372 5695 39...

output:

7
7
7
7
7
7
7
7
7
7
7
7
15
7
15
7
7
7
7
7
7
7
7
7
7
7
15
7
15
7
7
7
7
7
7
15
7
7
7
7
15
7
15
7
7
7
7
7
7
15

result:

ok 50 numbers

Test #12:

score: 0
Accepted
time: 30ms
memory: 4708kb

input:

5
100000
91675 46565 38979 3941 53894 98418 84900 84804 53487 7391 37558 42152 21892 48134 40091 35126 70005 1153 61201 47390 57436 20581 76773 48574 35571 42660 42943 41736 20593 53925 22043 8372 31184 39982 17663 22303 48407 27491 22257 13831 393 13278 29991 80618 89887 63441 66588 3667 95209 5383...

output:

7
15
7
15
15

result:

ok 5 number(s): "7 15 7 15 15"

Test #13:

score: 0
Accepted
time: 23ms
memory: 4760kb

input:

5
100000
302 215 197 62 232 313 291 291 231 85 193 205 147 219 200 187 264 33 247 217 239 143 277 220 188 206 207 204 143 232 148 91 176 199 132 149 220 165 149 117 19 115 173 283 299 251 258 60 308 232 146 306 197 294 154 246 245 305 134 237 129 217 233 192 65 210 290 153 309 212 229 155 157 33 260...

output:

1023
1023
1023
1023
1023

result:

ok 5 number(s): "1023 1023 1023 1023 1023"

Test #14:

score: 0
Accepted
time: 18ms
memory: 4864kb

input:

5
99999
5 5 5 5 5 5 4 5 4 5 5 5 5 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4 5 5 5 5 5 4 5 5 5 5 4 5 5 3 5 5 5 5 5 5 5 5 3 5 5 4 5 5 5 3 5 5 5 5 5 5 5 5 5 5 5 4 5 5 5 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4 5 5 5 5 5 5 5 5 5 5 5 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4 5 5 4 5 5 5 5 5 5 5 5 4 4 5 5 5 5 5 5 5 5 5 ...

output:

98303
98303
98303
98303
98303

result:

ok 5 number(s): "98303 98303 98303 98303 98303"

Test #15:

score: 0
Accepted
time: 28ms
memory: 4716kb

input:

5
99999
63915 63915 63915 63915 38059 63915 63915 63915 25192 63915 1024 63915 63915 63915 63915 63915 63915 63915 63915 63896 63915 63915 14963 63915 63915 63915 52208 84889 63915 63915 63915 63915 63915 40674 63915 62258 63915 63915 63915 16744 63915 63915 63915 96429 91077 63915 63915 63915 43576...

output:

65535
83967
65535
98303
57343

result:

ok 5 number(s): "65535 83967 65535 98303 57343"

Test #16:

score: 0
Accepted
time: 22ms
memory: 3556kb

input:

500
999
324 675 675 324 675 675 675 675 675 324 675 324 675 324 324 675 324 675 675 675 324 675 324 675 324 675 324 675 324 675 675 324 675 675 675 675 675 324 675 324 675 675 675 675 324 324 675 675 324 324 675 675 324 675 675 675 324 675 324 675 675 675 675 675 675 675 675 675 675 675 675 324 675 ...

output:

999
551
287
639
767
735
511
511
511
783
511
639
703
991
895
879
511
511
511
415
471
503
959
511
511
831
383
511
767
511
103
895
990
767
759
255
767
639
469
959
511
447
703
511
511
895
959
511
959
703
255
879
815
767
975
991
895
983
983
767
987
255
767
511
703
511
860
927
735
511
831
991
767
855
127
...

result:

ok 500 numbers

Test #17:

score: 0
Accepted
time: 22ms
memory: 3932kb

input:

50
10000
3548 5617 5617 3548 3548 1832 5617 5617 5617 3548 5617 5617 3548 5617 4445 3548 3548 3548 3548 5617 3548 5617 5617 5617 3548 3548 3548 5617 3548 5617 5617 3548 3548 5617 4470 3548 3548 5617 5617 5617 5617 5617 3548 5617 5617 3339 5617 3548 3548 6761 3548 3548 5617 3548 5617 5617 3548 3548 3...

output:

8191
4095
9343
9711
6143
6143
8191
6143
9939
5631
7487
8191
9215
9215
9215
8191
8191
8191
1535
8191
7679
7167
6142
8188
2047
9855
9215
6143
7999
9654
4095
7791
9263
6143
9215
5375
8382
9215
4095
7623
8191
8191
6143
3327
8063
7167
7167
4095
8191
8191

result:

ok 50 numbers

Test #18:

score: 0
Accepted
time: 19ms
memory: 3604kb

input:

500
999
675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 ...

output:

999
551
287
639
767
735
511
511
511
783
511
639
703
991
895
879
511
511
511
415
471
503
959
511
511
831
383
511
767
511
103
895
990
767
759
255
767
639
469
959
511
447
703
511
511
895
959
511
959
703
255
879
815
767
975
991
895
983
983
767
987
255
767
511
703
511
860
927
735
511
831
991
767
855
127
...

result:

ok 500 numbers

Extra Test:

score: 0
Extra Test Passed