QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#204902#7566. Interval Additionucup-team159#AC ✓493ms265248kbC++2318.5kb2023-10-07 14:20:232023-10-07 14:20:24

Judging History

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

  • [2023-10-07 14:20:24]
  • 评测
  • 测评结果:AC
  • 用时:493ms
  • 内存:265248kb
  • [2023-10-07 14:20:23]
  • 提交

answer

#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
//#pragma GCC optimize("Ofast")
//#undef LOCAL


#include <unistd.h>
#include <algorithm>
#include <array>
#include <cassert>
#include <cctype>
#include <cstring>
#include <sstream>
#include <string>
#include <type_traits>
#include <vector>


namespace yosupo {

namespace internal {

int ceil_pow2(int n) {
    int x = 0;
    while ((1U << x) < (unsigned int)(n)) x++;
    return x;
}

}  // namespace internal

int bsf(unsigned int n) { return __builtin_ctz(n); }
int bsf(unsigned long n) { return __builtin_ctzl(n); }
int bsf(unsigned long long n) { return __builtin_ctzll(n); }
int bsf(unsigned __int128 n) {
    unsigned long long low = (unsigned long long)(n);
    unsigned long long high = (unsigned long long)(n >> 64);
    return low ? __builtin_ctzll(low) : 64 + __builtin_ctzll(high);
}

int bsr(unsigned int n) {
    return 8 * (int)sizeof(unsigned int) - 1 - __builtin_clz(n);
}
int bsr(unsigned long n) {
    return 8 * (int)sizeof(unsigned long) - 1 - __builtin_clzl(n);
}
int bsr(unsigned long long n) {
    return 8 * (int)sizeof(unsigned long long) - 1 - __builtin_clzll(n);
}
int bsr(unsigned __int128 n) {
    unsigned long long low = (unsigned long long)(n);
    unsigned long long high = (unsigned long long)(n >> 64);
    return high ? 127 - __builtin_clzll(high) : 63 - __builtin_ctzll(low);
}

int popcnt(unsigned int n) { return __builtin_popcount(n); }
int popcnt(unsigned long n) { return __builtin_popcountl(n); }
int popcnt(unsigned long long n) { return __builtin_popcountll(n); }

}  // namespace yosupo

#include <cassert>
#include <numeric>
#include <type_traits>

namespace yosupo {

namespace internal {

template <class T>
using is_signed_int128 =
    typename std::conditional<std::is_same<T, __int128_t>::value ||
                                  std::is_same<T, __int128>::value,
                              std::true_type,
                              std::false_type>::type;

template <class T>
using is_unsigned_int128 =
    typename std::conditional<std::is_same<T, __uint128_t>::value ||
                                  std::is_same<T, unsigned __int128>::value,
                              std::true_type,
                              std::false_type>::type;

template <class T>
using make_unsigned_int128 =
    typename std::conditional<std::is_same<T, __int128_t>::value,
                              __uint128_t,
                              unsigned __int128>;

template <class T>
using is_integral =
    typename std::conditional<std::is_integral<T>::value ||
                                  internal::is_signed_int128<T>::value ||
                                  internal::is_unsigned_int128<T>::value,
                              std::true_type,
                              std::false_type>::type;

template <class T>
using is_signed_int = typename std::conditional<(is_integral<T>::value &&
                                                 std::is_signed<T>::value) ||
                                                    is_signed_int128<T>::value,
                                                std::true_type,
                                                std::false_type>::type;

template <class T>
using is_unsigned_int =
    typename std::conditional<(is_integral<T>::value &&
                               std::is_unsigned<T>::value) ||
                                  is_unsigned_int128<T>::value,
                              std::true_type,
                              std::false_type>::type;

template <class T>
using to_unsigned = typename std::conditional<
    is_signed_int128<T>::value,
    make_unsigned_int128<T>,
    typename std::conditional<std::is_signed<T>::value,
                              std::make_unsigned<T>,
                              std::common_type<T>>::type>::type;

template <class T>
using is_integral_t = std::enable_if_t<is_integral<T>::value>;

template <class T>
using is_signed_int_t = std::enable_if_t<is_signed_int<T>::value>;

template <class T>
using is_unsigned_int_t = std::enable_if_t<is_unsigned_int<T>::value>;

template <class T> using to_unsigned_t = typename to_unsigned<T>::type;

}  // namespace internal

}  // namespace yosupo

namespace yosupo {

struct Scanner {
  public:
    Scanner(const Scanner&) = delete;
    Scanner& operator=(const Scanner&) = delete;

    Scanner(FILE* fp) : fd(fileno(fp)) { line[0] = 127; }

    void read() {}
    template <class H, class... T> void read(H& h, T&... t) {
        bool f = read_single(h);
        assert(f);
        read(t...);
    }

    int read_unsafe() { return 0; }
    template <class H, class... T> int read_unsafe(H& h, T&... t) {
        bool f = read_single(h);
        if (!f) return 0;
        return 1 + read_unsafe(t...);
    }

    int close() { return ::close(fd); }

  private:
    static constexpr int SIZE = 1 << 15;

    int fd = -1;
    std::array<char, SIZE + 1> line;
    int st = 0, ed = 0;
    bool eof = false;

    bool read_single(std::string& ref) {
        if (!skip_space()) return false;
        ref = "";
        while (true) {
            char c = top();
            if (c <= ' ') break;
            ref += c;
            st++;
        }
        return true;
    }
    bool read_single(double& ref) {
        std::string s;
        if (!read_single(s)) return false;
        ref = std::stod(s);
        return true;
    }

    template <class T,
              std::enable_if_t<std::is_same<T, char>::value>* = nullptr>
    bool read_single(T& ref) {
        if (!skip_space<50>()) return false;
        ref = top();
        st++;
        return true;
    }

    template <class T,
              internal::is_signed_int_t<T>* = nullptr,
              std::enable_if_t<!std::is_same<T, char>::value>* = nullptr>
    bool read_single(T& sref) {
        using U = internal::to_unsigned_t<T>;
        if (!skip_space<50>()) return false;
        bool neg = false;
        if (line[st] == '-') {
            neg = true;
            st++;
        }
        U ref = 0;
        do {
            ref = 10 * ref + (line[st++] & 0x0f);
        } while (line[st] >= '0');
        sref = neg ? -ref : ref;
        return true;
    }
    template <class U,
              internal::is_unsigned_int_t<U>* = nullptr,
              std::enable_if_t<!std::is_same<U, char>::value>* = nullptr>
    bool read_single(U& ref) {
        if (!skip_space<50>()) return false;
        ref = 0;
        do {
            ref = 10 * ref + (line[st++] & 0x0f);
        } while (line[st] >= '0');
        return true;
    }

    bool reread() {
        if (ed - st >= 50) return true;
        if (st > SIZE / 2) {
            std::memmove(line.data(), line.data() + st, ed - st);
            ed -= st;
            st = 0;
        }
        if (eof) return false;
        auto u = ::read(fd, line.data() + ed, SIZE - ed);
        if (u == 0) {
            eof = true;
            line[ed] = '\0';
            u = 1;
        }
        ed += int(u);
        line[ed] = char(127);
        return true;
    }

    char top() {
        if (st == ed) {
            bool f = reread();
            assert(f);
        }
        return line[st];
    }

    template <int TOKEN_LEN = 0> bool skip_space() {
        while (true) {
            while (line[st] <= ' ') st++;
            if (ed - st > TOKEN_LEN) return true;
            if (st > ed) st = ed;
            for (auto i = st; i < ed; i++) {
                if (line[i] <= ' ') return true;
            }
            if (!reread()) return false;
        }
    }
};

struct Printer {
  public:
    template <char sep = ' ', bool F = false> void write() {}
    template <char sep = ' ', bool F = false, class H, class... T>
    void write(const H& h, const T&... t) {
        if (F) write_single(sep);
        write_single(h);
        write<true>(t...);
    }
    template <char sep = ' ', class... T> void writeln(const T&... t) {
        write<sep>(t...);
        write_single('\n');
    }

    Printer(FILE* _fp) : fd(fileno(_fp)) {}
    ~Printer() { flush(); }

    int close() {
        flush();
        return ::close(fd);
    }

    void flush() {
        if (pos) {
            auto res = ::write(fd, line.data(), pos);
            assert(res != -1);
            pos = 0;
        }
    }

  private:
    static std::array<std::array<char, 2>, 100> small;
    static std::array<unsigned long long, 20> tens;

    static constexpr size_t SIZE = 1 << 15;
    int fd;
    std::array<char, SIZE> line;
    size_t pos = 0;
    std::stringstream ss;

    template <class T,
              std::enable_if_t<std::is_same<char, T>::value>* = nullptr>
    void write_single(const T& val) {
        if (pos == SIZE) flush();
        line[pos++] = val;
    }

    template <class T,
              internal::is_signed_int_t<T>* = nullptr,
              std::enable_if_t<!std::is_same<char, T>::value>* = nullptr>
    void write_single(const T& val) {
        using U = internal::to_unsigned_t<T>;
        if (val == 0) {
            write_single('0');
            return;
        }
        if (pos > SIZE - 50) flush();
        U uval = val;
        if (val < 0) {
            write_single('-');
            uval = -uval;
        }
        write_unsigned(uval);
    }

    template <class U, internal::is_unsigned_int_t<U>* = nullptr>
    void write_single(U uval) {
        if (uval == 0) {
            write_single('0');
            return;
        }
        if (pos > SIZE - 50) flush();

        write_unsigned(uval);
    }

    template <class U, internal::is_unsigned_int_t<U>* = nullptr>
    static int calc_len(U x) {
        int i = (bsr(x) * 3 + 3) / 10;
        if (x < tens[i])
            return i;
        else
            return i + 1;
    }

    template <class U,
              internal::is_unsigned_int_t<U>* = nullptr,
              std::enable_if_t<2 >= sizeof(U)>* = nullptr>
    void write_unsigned(U uval) {
        size_t len = calc_len(uval);
        pos += len;

        char* ptr = line.data() + pos;
        while (uval >= 100) {
            ptr -= 2;
            memcpy(ptr, small[uval % 100].data(), 2);
            uval /= 100;
        }
        if (uval >= 10) {
            memcpy(ptr - 2, small[uval].data(), 2);
        } else {
            *(ptr - 1) = char('0' + uval);
        }
    }

    template <class U,
              internal::is_unsigned_int_t<U>* = nullptr,
              std::enable_if_t<4 == sizeof(U)>* = nullptr>
    void write_unsigned(U uval) {
        std::array<char, 8> buf;
        memcpy(buf.data() + 6, small[uval % 100].data(), 2);
        memcpy(buf.data() + 4, small[uval / 100 % 100].data(), 2);
        memcpy(buf.data() + 2, small[uval / 10000 % 100].data(), 2);
        memcpy(buf.data() + 0, small[uval / 1000000 % 100].data(), 2);

        if (uval >= 100000000) {
            if (uval >= 1000000000) {
                memcpy(line.data() + pos, small[uval / 100000000 % 100].data(),
                       2);
                pos += 2;
            } else {
                line[pos] = char('0' + uval / 100000000);
                pos++;
            }
            memcpy(line.data() + pos, buf.data(), 8);
            pos += 8;
        } else {
            size_t len = calc_len(uval);
            memcpy(line.data() + pos, buf.data() + (8 - len), len);
            pos += len;
        }
    }

    template <class U,
              internal::is_unsigned_int_t<U>* = nullptr,
              std::enable_if_t<8 == sizeof(U)>* = nullptr>
    void write_unsigned(U uval) {
        size_t len = calc_len(uval);
        pos += len;

        char* ptr = line.data() + pos;
        while (uval >= 100) {
            ptr -= 2;
            memcpy(ptr, small[uval % 100].data(), 2);
            uval /= 100;
        }
        if (uval >= 10) {
            memcpy(ptr - 2, small[uval].data(), 2);
        } else {
            *(ptr - 1) = char('0' + uval);
        }
    }

    template <
        class U,
        std::enable_if_t<internal::is_unsigned_int128<U>::value>* = nullptr>
    void write_unsigned(U uval) {
        static std::array<char, 50> buf;
        size_t len = 0;
        while (uval > 0) {
            buf[len++] = char((uval % 10) + '0');
            uval /= 10;
        }
        std::reverse(buf.begin(), buf.begin() + len);
        memcpy(line.data() + pos, buf.data(), len);
        pos += len;
    }

    void write_single(const std::string& s) {
        for (char c : s) write_single(c);
    }
    void write_single(const char* s) {
        size_t len = strlen(s);
        for (size_t i = 0; i < len; i++) write_single(s[i]);
    }
    template <class T> void write_single(const std::vector<T>& val) {
        auto n = val.size();
        for (size_t i = 0; i < n; i++) {
            if (i) write_single(' ');
            write_single(val[i]);
        }
    }
};

std::array<std::array<char, 2>, 100> Printer::small = [] {
    std::array<std::array<char, 2>, 100> table;
    for (int i = 0; i <= 99; i++) {
        table[i][1] = char('0' + (i % 10));
        table[i][0] = char('0' + (i / 10 % 10));
    }
    return table;
}();
std::array<unsigned long long, 20> Printer::tens = [] {
    std::array<unsigned long long, 20> table;
    for (int i = 0; i < 20; i++) {
        table[i] = 1;
        for (int j = 0; j < i; j++) {
            table[i] *= 10;
        }
    }
    return table;
}();

}  // namespace yosupo
using namespace yosupo;

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <complex>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <memory>

using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;

#ifdef LOCAL

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

template <class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p);
template <class T> ostream& operator<<(ostream& os, const V<T>& v);
template <class T> ostream& operator<<(ostream& os, const deque<T>& v);
template <class T, size_t N>
ostream& operator<<(ostream& os, const array<T, N>& a);
template <class T> ostream& operator<<(ostream& os, const set<T>& s);
template <class T, class U>
ostream& operator<<(ostream& os, const map<T, U>& m);

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

template <class T> ostream& operator<<(ostream& os, const V<T>& v) {
    os << "[";
    bool f = false;
    for (auto d : v) {
        if (f) os << ", ";
        f = true;
        os << d;
    }
    return os << "]";
}

template <class T> ostream& operator<<(ostream& os, const deque<T>& v) {
    os << "[";
    bool f = false;
    for (auto d : v) {
        if (f) os << ", ";
        f = true;
        os << d;
    }
    return os << "]";
}
template <class T, size_t N>
ostream& operator<<(ostream& os, const array<T, N>& a) {
    os << "[";
    bool f = false;
    for (auto d : a) {
        if (f) os << ", ";
        f = true;
        os << d;
    }
    return os << "]";
}

template <class T> ostream& operator<<(ostream& os, const set<T>& s) {
    os << "{";
    bool f = false;
    for (auto d : s) {
        if (f) os << ", ";
        f = true;
        os << d;
    }
    return os << "}";
}
template <class T> ostream& operator<<(ostream& os, const multiset<T>& s) {
    os << "{";
    bool f = false;
    for (auto d : s) {
        if (f) os << ", ";
        f = true;
        os << d;
    }
    return os << "}";
}

template <class T, class U>
ostream& operator<<(ostream& os, const map<T, U>& s) {
    os << "{";
    bool f = false;
    for (auto p : s) {
        if (f) os << ", ";
        f = true;
        os << p.first << ": " << p.second;
    }
    return os << "}";
}

struct PrettyOS {
    ostream& os;
    bool first;

    template <class T> auto operator<<(T&& x) {
        if (!first) os << ", ";
        first = false;
        os << x;
        return *this;
    }
};
template <class... T> void dbg0(T&&... t) {
    (PrettyOS{cerr, true} << ... << t);
}
#define dbg(...)                                            \
    do {                                                    \
        cerr << __LINE__ << " : " << #__VA_ARGS__ << " = "; \
        dbg0(__VA_ARGS__);                                  \
        cerr << endl;                                       \
    } while (false);
#else
#define dbg(...)
#endif

Scanner sc = Scanner(stdin);
Printer pr = Printer(stdout);

int main() {
    int n;
    sc.read(n);
    V<ll> a;
    {
        V<ll> b(n + 2);
        for (int i = 1; i <= n; i++) {
            sc.read(b[i]);
        }
        a = V<ll>(n + 1);
        for (int i = 0; i <= n; i++) {
            a[i] = b[i + 1] - b[i];
        }
        n++;
    }

    V<ll> sumb(1 << n);
    V<int> ok(1 << n);
    for (int i = 1; i < (1 << n); i++) {
        int k = 0;
        while (!(i & (1 << k))) k++;
        sumb[i] = sumb[i ^ (1 << k)] + a[k];

        if (i && sumb[i] == 0) ok[i] = 1;
    }

    V<int> dp(1 << n);
    for (int h = 0; h < n; h++) {
        for (int i = 0; i < (1 << h); i++) {
            int j = i ^ (1 << h);
            if (ok[j]) {
                dp[j] = dp[i] + 1;
            }
        }

        for (int k = 0; k <= h; k++) {
            for (int i = 0; i < (2 << h); i++) {
                if (i & (1 << k)) continue;
                int j = i ^ (1 << k);
                dp[j] = max(dp[j], dp[i]);
            }
        }
    }

    int ans = dp.back();
    pr.writeln(n - ans);
    return 0;
}

詳細信息

Test #1:

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

input:

5
1 2 3 2 1

output:

3

result:

ok 1 number(s): "3"

Test #2:

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

input:

6
1 1 4 5 1 4

output:

4

result:

ok 1 number(s): "4"

Test #3:

score: 0
Accepted
time: 475ms
memory: 265152kb

input:

23
154867764 88416234 958556716 525347353 297126571 748390457 991684429 346718178 898503520 361211695 769645122 37543644 545129269 108357111 477091071 990326512 89442247 500865905 865261751 881423606 884862773 342044622 545846884

output:

23

result:

ok 1 number(s): "23"

Test #4:

score: 0
Accepted
time: 470ms
memory: 265140kb

input:

23
120512728 488581138 644845116 520600533 100830035 819227263 160270658 973159498 726973004 621205731 645066544 284705591 139812862 771961411 928673722 774153929 872014266 753699081 71306808 6052789 859500856 467237467 917534614

output:

23

result:

ok 1 number(s): "23"

Test #5:

score: 0
Accepted
time: 1ms
memory: 3488kb

input:

10
625630902 579967568 160371090 238722458 707634839 237285041 459491010 454916131 608704408 709619323

output:

10

result:

ok 1 number(s): "10"

Test #6:

score: 0
Accepted
time: 1ms
memory: 3488kb

input:

1
46422493

output:

1

result:

ok 1 number(s): "1"

Test #7:

score: 0
Accepted
time: 471ms
memory: 265100kb

input:

23
500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 499999953 499999953 499999953 499999953 499999953 499999953 499999953 499999953 500000000 500000000 500000000 500000000 500000000 500000000 500000000

output:

2

result:

ok 1 number(s): "2"

Test #8:

score: 0
Accepted
time: 462ms
memory: 265124kb

input:

23
500000011 500000011 500000026 500000026 500000026 500000026 500000026 500000026 500000026 500000045 500000045 500000015 500000015 500000015 500000015 500000000 500000096 500000041 500000041 500000041 500000096 500000096 500000000

output:

6

result:

ok 1 number(s): "6"

Test #9:

score: 0
Accepted
time: 468ms
memory: 265120kb

input:

23
500000000 500000000 500000066 500000073 500000073 500000182 500000182 500000087 500000169 500000169 500000133 500000133 500000035 500000035 499999871 499999865 499999865 499999865 500000154 500000072 500000072 500000096 500000000

output:

11

result:

ok 1 number(s): "11"

Test #10:

score: 0
Accepted
time: 470ms
memory: 265148kb

input:

23
499999858 499999791 499999811 499999854 499999847 499999769 499999893 499999791 499999757 499999924 500000215 500000063 499999986 500000146 499999907 500000007 499999789 499999985 499999874 499999884 500000008 499999922 499999917

output:

19

result:

ok 1 number(s): "19"

Test #11:

score: 0
Accepted
time: 458ms
memory: 265132kb

input:

23
500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500006627 500006627 500006627 500006627 500006627 500006627 500006627 500006627 500000000 500000000

output:

2

result:

ok 1 number(s): "2"

Test #12:

score: 0
Accepted
time: 457ms
memory: 265132kb

input:

23
500000000 499991668 499991668 499991668 499991668 499991668 499992421 499992421 499992421 499992421 499992421 499992421 499992421 499991701 499991701 500007356 500007323 500007323 500007323 500007323 500007323 500007323 500006700

output:

6

result:

ok 1 number(s): "6"

Test #13:

score: 0
Accepted
time: 454ms
memory: 265128kb

input:

23
500008971 500007158 500007158 500007158 500007158 500007158 500016740 500016740 500023431 500029646 500031770 500025555 500025555 500025555 500025555 500020962 500011380 500014021 500011069 500012381 500009692 500005314 500005314

output:

11

result:

ok 1 number(s): "11"

Test #14:

score: 0
Accepted
time: 456ms
memory: 265112kb

input:

23
500004790 500011043 500001539 499988427 499989318 500002907 499992442 500000344 500013204 500032360 500022060 500005386 499989135 499995181 499970440 499974934 499970234 499985465 499988500 499997841 499978295 499995992 499985112

output:

21

result:

ok 1 number(s): "21"

Test #15:

score: 0
Accepted
time: 443ms
memory: 265140kb

input:

23
500000000 500000000 500775103 500775103 500775103 500775103 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000

output:

2

result:

ok 1 number(s): "2"

Test #16:

score: 0
Accepted
time: 444ms
memory: 265248kb

input:

23
500000000 500000000 500000000 499317985 499883344 499883344 499883344 499883344 499047944 499814976 499814976 499007908 498442549 498442549 498442549 499164600 499164600 499164600 499164600 500000000 500000000 500000000 500000000

output:

6

result:

ok 1 number(s): "6"

Test #17:

score: 0
Accepted
time: 454ms
memory: 265152kb

input:

23
500578170 501342629 500685333 500685333 500685333 500434440 500434440 500833302 500833302 500018930 500352528 500127753 500603421 501751304 501417793 500685333 500685333 499920874 500578170 500000000 500420306 500420306 500420306

output:

11

result:

ok 1 number(s): "11"

Test #18:

score: 0
Accepted
time: 461ms
memory: 265084kb

input:

23
501122407 505187190 506309930 504626086 504486924 505864777 505478791 504987294 506389246 504959954 503907177 503951359 504513755 503329719 502108244 500920912 502168527 499084052 499787444 501128474 502585881 500042621 498430594

output:

23

result:

ok 1 number(s): "23"

Test #19:

score: 0
Accepted
time: 464ms
memory: 265120kb

input:

23
500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 499999978 499999978 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000

output:

2

result:

ok 1 number(s): "2"

Test #20:

score: 0
Accepted
time: 463ms
memory: 265108kb

input:

23
500000000 500000000 499999924 499999924 499999952 499999952 500000028 499999983 499999983 500000069 500000069 500000069 500000069 500000069 500000148 500000148 500000069 500000069 500000069 500000000 500000000 500000000 500000000

output:

6

result:

ok 1 number(s): "6"

Test #21:

score: 0
Accepted
time: 457ms
memory: 265104kb

input:

23
500000000 499999969 499999929 499999929 499999779 499999747 499999747 499999747 499999667 499999707 499999930 499999891 499999891 499999881 499999881 499999845 499999925 499999925 499999964 499999964 499999904 499999964 500000000

output:

10

result:

ok 1 number(s): "10"

Test #22:

score: 0
Accepted
time: 493ms
memory: 265108kb

input:

23
500000155 500000315 500000231 500000048 500000372 500000424 500000278 500000277 500000124 500000103 500000191 499999987 499999852 499999617 499999631 499999629 499999711 499999651 499999585 499999530 499999495 499999747 499999993

output:

19

result:

ok 1 number(s): "19"

Test #23:

score: 0
Accepted
time: 472ms
memory: 265104kb

input:

23
500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500006119 500006119 500006119 500006119 500006119 500006119 500000000 500000000 500000000 500000000

output:

2

result:

ok 1 number(s): "2"

Test #24:

score: 0
Accepted
time: 483ms
memory: 265136kb

input:

23
500000000 499991623 499991623 499991623 499991623 499984295 499975156 499975156 499975156 499976321 499976321 499976321 499976321 499993837 499993837 499993837 500001165 500001165 500001165 500000000 500000936 500000936 500000936

output:

6

result:

ok 1 number(s): "6"

Test #25:

score: 0
Accepted
time: 472ms
memory: 265088kb

input:

23
500000000 500002755 500002755 500002067 500002067 500002067 500007059 500007132 500015950 500015950 500010958 499993925 499993925 499995224 499997138 500004895 500004895 499999276 499999276 499996521 500000841 500000841 500000000

output:

11

result:

ok 1 number(s): "11"

Test #26:

score: 0
Accepted
time: 459ms
memory: 265116kb

input:

23
500009706 500006191 499984915 500014440 500023321 500026011 500039936 500024527 500036349 500046344 500041663 500021759 500032357 500030712 500006508 500019971 500032469 500052348 500028446 500001617 500011492 500019408 500015211

output:

21

result:

ok 1 number(s): "21"

Test #27:

score: 0
Accepted
time: 466ms
memory: 265092kb

input:

23
500000000 500000000 500000000 499207037 499207037 499207037 499207037 499207037 499207037 499207037 499207037 499207037 499207037 499207037 499207037 499207037 499207037 499207037 499207037 499207037 499207037 499207037 499207037

output:

2

result:

ok 1 number(s): "2"

Test #28:

score: 0
Accepted
time: 454ms
memory: 265148kb

input:

23
500000000 500000000 499906417 499906417 499004628 498250213 498250213 498250213 498250213 498250213 498250213 498250213 498326320 498326320 498326320 499004628 499004628 499004628 499098211 499098211 500000000 500000000 500000000

output:

5

result:

ok 1 number(s): "5"

Test #29:

score: 0
Accepted
time: 482ms
memory: 265140kb

input:

23
500000000 499433731 498421805 498421805 498210823 498006549 498006549 498006549 498006549 498587939 498661850 498661850 498291442 498291442 498388735 499246254 500160887 500160887 500903970 501108244 501674513 500857519 500000000

output:

10

result:

ok 1 number(s): "10"

Test #30:

score: 0
Accepted
time: 476ms
memory: 265136kb

input:

23
498848100 495902575 495746206 496218670 495979695 497212048 498148282 498317731 497827244 497356221 496914395 491578419 489374599 490446554 488473546 490054662 493713401 493738233 495454097 496961762 497102961 498246670 499168534

output:

23

result:

ok 1 number(s): "23"

Test #31:

score: 0
Accepted
time: 492ms
memory: 265120kb

input:

23
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5 5 5 5

output:

1

result:

ok 1 number(s): "1"

Test #32:

score: 0
Accepted
time: 458ms
memory: 265124kb

input:

23
4 0 0 0 3 3 3 9 9 9 9 9 9 9 9 7 7 2 2 2 2 2 0

output:

5

result:

ok 1 number(s): "5"

Test #33:

score: 0
Accepted
time: 450ms
memory: 265076kb

input:

23
0 0 2 0 0 0 2 2 7 6 8 8 8 5 5 0 2 10 2 2 11 9 0

output:

8

result:

ok 1 number(s): "8"

Test #34:

score: 0
Accepted
time: 455ms
memory: 265128kb

input:

23
0 0 0 0 0 58 58 58 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

output:

1

result:

ok 1 number(s): "1"

Test #35:

score: 0
Accepted
time: 449ms
memory: 265140kb

input:

23
0 0 0 0 0 0 0 0 0 0 0 14 0 0 0 0 0 0 0 0 0 0 0

output:

1

result:

ok 1 number(s): "1"

Test #36:

score: 0
Accepted
time: 441ms
memory: 265120kb

input:

23
0 26 0 0 0 0 12 12 0 17 17 25 25 25 49 0 0 21 0 0 0 0 0

output:

6

result:

ok 1 number(s): "6"

Test #37:

score: 0
Accepted
time: 451ms
memory: 265104kb

input:

23
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 387 387 387 387 387 387

output:

1

result:

ok 1 number(s): "1"

Test #38:

score: 0
Accepted
time: 443ms
memory: 265072kb

input:

23
0 0 0 0 0 0 0 0 0 471 471 471 0 0 0 0 0 255 255 0 0 0 0

output:

2

result:

ok 1 number(s): "2"

Test #39:

score: 0
Accepted
time: 448ms
memory: 265116kb

input:

23
0 39 39 39 0 0 0 0 0 0 0 0 0 0 56 618 618 0 507 507 0 0 0

output:

4

result:

ok 1 number(s): "4"

Test #40:

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

input:

12
500000000 500000000 500000000 500000000 500000000 500000000 500000000 499999925 499999925 499999925 500000000 500000000

output:

2

result:

ok 1 number(s): "2"

Test #41:

score: 0
Accepted
time: 1ms
memory: 3644kb

input:

12
500000068 500000068 500000068 500000068 500000236 500000236 500000348 500000280 500000280 500000252 500000178 500000094

output:

6

result:

ok 1 number(s): "6"

Test #42:

score: 0
Accepted
time: 1ms
memory: 3588kb

input:

12
500000036 500000036 500000094 500000091 500000071 500000180 500000139 500000139 500000081 500000052 500000052 500000066

output:

8

result:

ok 1 number(s): "8"

Test #43:

score: 0
Accepted
time: 1ms
memory: 3608kb

input:

12
500000275 499999911 499999869 499999727 499999605 499999420 499999573 499999445 499999454 499999592 499999536 499999675

output:

11

result:

ok 1 number(s): "11"

Test #44:

score: 0
Accepted
time: 1ms
memory: 3548kb

input:

12
500000000 500000000 500000000 500000000 500000000 500000000 500000000 499993913 499993913 500000000 500000000 500000000

output:

2

result:

ok 1 number(s): "2"

Test #45:

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

input:

12
500006067 500006067 500006067 499999092 499999092 500004693 499998027 499992426 499985213 499993025 500000000 500000000

output:

6

result:

ok 1 number(s): "6"

Test #46:

score: 0
Accepted
time: 1ms
memory: 3532kb

input:

12
500000693 500008328 499994319 499994319 499994319 499988701 499995255 499995255 499996495 500003850 499996215 499996814

output:

8

result:

ok 1 number(s): "8"

Test #47:

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

input:

12
499995758 500029554 500038100 500105274 500056969 500051722 500049028 500006103 500002095 500008779 500012816 500004278

output:

12

result:

ok 1 number(s): "12"

Test #48:

score: 0
Accepted
time: 1ms
memory: 3644kb

input:

12
500000000 500808447 500808447 500808447 500808447 500000000 500000000 500000000 500000000 500000000 500000000 500000000

output:

2

result:

ok 1 number(s): "2"

Test #49:

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

input:

12
499754295 499754295 499754295 499519818 500429969 500664446 500774079 501489727 500579576 500469943 500469943 500000000

output:

6

result:

ok 1 number(s): "6"

Test #50:

score: 0
Accepted
time: 1ms
memory: 3580kb

input:

12
499117991 498271666 499225658 499225658 499487368 500063644 499528612 500410621 501005234 500204419 499960542 499789532

output:

10

result:

ok 1 number(s): "10"

Test #51:

score: 0
Accepted
time: 1ms
memory: 3644kb

input:

12
501960621 504050777 504603727 504435368 501735026 502850106 501772052 498494818 494609715 495382734 496351255 499241585

output:

12

result:

ok 1 number(s): "12"

Test #52:

score: 0
Accepted
time: 452ms
memory: 265092kb

input:

23
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

output:

0

result:

ok 1 number(s): "0"