QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#256594#7747. Memoryucup-team159#AC ✓4ms5588kbC++2018.2kb2023-11-18 20:26:592023-11-22 13:05:07

Judging History

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

  • [2023-11-22 13:05:07]
  • 自动重测本题所有获得100分的提交记录
  • 测评结果:AC
  • 用时:4ms
  • 内存:5588kb
  • [2023-11-18 20:27:01]
  • 评测
  • 测评结果:100
  • 用时:4ms
  • 内存:5584kb
  • [2023-11-18 20:26:59]
  • 提交

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);

V<bool> solve(V<ll> a) {
    ll sum = 0;
    V<bool> ans;
    for (auto x : a) {
        if (sum % 2) sum--;
        sum /= 2;
        sum += x;
        ans.push_back(sum >= 0);
    }
    return ans;
}

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

    auto x = solve(a);
    auto y = solve(b);

    string s;
    for (int i = 0; i < n; i++) {
        if (x[i] && y[i]) {
            s += "0";
        } else if (x[i]) {
            s += "+";
        } else if (y[i]) {
            s += "-";
        } else {
            assert(false);
        }
    }
    pr.writeln(s);
    return 0;
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3432kb

input:

10
2 -1 4 -7 4 -8 3 -6 4 -7

output:

+0+-+---+-

result:

ok single line: '+0+-+---+-'

Test #2:

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

input:

10
-1 36 18 18 18 18 18 18 18 -18

output:

-++++++++-

result:

ok single line: '-++++++++-'

Test #3:

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

input:

1000
-1 193552 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 967...

output:

-+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++...

result:

ok single line: '-+++++++++++++++++++++++++++++...++++++++++++++++++++++++++++++-'

Test #4:

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

input:

100000
-1 696082628 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 ...

output:

-+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++...

result:

ok single line: '-+++++++++++++++++++++++++++++...++++++++++++++++++++++++++++++-'

Test #5:

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

input:

10
-1 70 -35 -72 36 12 -6 42 -21 -84

output:

-+---+-+--

result:

ok single line: '-+---+-+--'

Test #6:

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

input:

1000
-1 -120742 60371 -567374 283687 -507718 253859 -579246 289623 21402 -10701 539474 -269737 -681332 340666 -746052 373026 -993382 496691 -333880 166940 -632724 316362 909690 -454845 86680 -43340 236688 -118344 -29102 14551 6252 -3126 -440612 220306 -878460 439230 649538 -324769 -651632 325816 882...

output:

---------+-+-----------+-+-+---+-----+---+-+-+---+-+-+-+-+---+-----+-----+---+-+-----+-----+-+-+---+---+-+-----+-------+-+---+-----+-+-+-------+-+-+-+-+-------+-----+-+-+-------+-------+-+-+-------+---+-+---+-+---+-+-+-+---+-+-+-+-+---------+-----+-----+-+-+-+-+-+-+-+---+-+-+-------+---+-+-+-+-+-+--...

result:

ok single line: '---------+-+-----------+-+-+--...+---+-+-+-+-+-----+-+---------+'

Test #7:

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

input:

100000
-1 126247070 -63123535 -440273040 220136520 809537358 -404768679 -927404550 463702275 896759686 -448379843 155450002 -77725001 995415070 -497707535 -730811632 365405816 -223816910 111908455 255855870 -127927935 -78358522 39179261 190117110 -95058555 -61118274 30559137 243732804 -121866402 -48...

output:

-+---+---+-+-+-----+---+---+-------+-+-+---+-----+---+-+-+-----+-+-----+-----+-+---+-+---+---+-+-+-+-+-----------+---+-+-+-------+-+-+---+-----+-------+-+---+-+---------------+-----------------+-+-----+-+-+---+-+-+-+---+-+-----+-+-+---+-+-----+-+-+-----+-----+-+-+-----+-+-+-----+-+---+-+---+-+-+-+--...

result:

ok single line: '-+---+---+-+-+-----+---+---+--...--+-+-+---+---+---+---+-+------'

Test #8:

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

input:

10
0 2 -1 88 -44 14 -7 -32 16 32

output:

0+0+0+0-0+

result:

ok single line: '0+0+0+0-0+'

Test #9:

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

input:

1000
0 804678 -402339 501804 -250902 701336 -350668 341920 -170960 234558 -117279 138082 -69041 383094 -191547 613608 -306804 -173632 86816 105660 -52830 268340 -134170 -786944 393472 -702908 351454 236550 -118275 83428 -41714 280776 -140388 -743190 371595 -762656 381328 -873564 436782 565326 -28266...

output:

0+0+0+0+0+0+0+0+0-0+0+0-0-0+0+0+0-0-0-0+0+0-0-0+0+0-0+0-0+0-0+0-0-0-0+0+0+0-0+0+0-0-0+0+0+0-0+0-0-0+0-0-0-0-0-0+0-0+0-0-0-0+0-0+0-0+0+0-0+0-0+0-0+0-0-0+0+0-0+0-0+0-0+0-0+0+0+0-0+0-0-0-0+0+0-0+0+0+0+0+0-0+0-0+0-0+0+0-0-0-0+0+0+0+0-0+0-0-0+0+0-0-0+0+0+0-0+0+0-0+0-0+0+0-0+0-0+0+0+0-0+0-0-0-0-0-0+0-0+0+...

result:

ok single line: '0+0+0+0+0+0+0+0+0-0+0+0-0-0+0+...-0-0+0+0+0-0-0-0-0-0+0-0+0-0+0+'

Test #10:

score: 0
Accepted
time: 4ms
memory: 5588kb

input:

100000
0 281054714 -140527357 181299510 -90649755 -155852956 77926478 804466996 -402233498 100794828 -50397414 -498194394 249097197 674196350 -337098175 947822240 -473911120 649015454 -324507727 -445192880 222596440 517778906 -258889453 580158794 -290079397 -634780702 317390351 -689237014 344618507 ...

output:

0+0+0-0+0+0-0+0+0+0-0+0+0-0-0-0+0-0-0+0+0-0-0+0+0+0+0+0-0+0+0-0-0-0+0+0+0-0+0+0-0-0-0-0-0-0+0+0-0-0+0+0-0+0+0+0+0-0+0-0-0+0+0-0+0-0-0+0+0-0+0+0+0-0+0+0+0-0+0-0-0+0-0-0-0-0-0-0+0-0-0-0+0-0-0+0+0+0+0-0-0+0-0+0-0+0+0-0+0-0+0-0+0+0+0-0-0+0-0+0-0+0+0-0+0+0+0+0+0+0+0-0+0-0+0+0+0-0-0-0+0-0+0-0-0+0-0-0-0-0-...

result:

ok single line: '0+0+0-0+0+0-0+0+0+0-0+0+0-0-0-...-0-0-0+0+0-0+0+0+0+0+0-0-0-0+0-'

Test #11:

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

input:

10
1 96 -48 -50 25 38 -19 -16 8 64

output:

+++-+++-++

result:

ok single line: '+++-+++-++'

Test #12:

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

input:

1000
1 -233282 116641 245142 -122571 -866732 433366 342040 -171020 -114326 57163 -723670 361835 559940 -279970 47632 -23816 -546562 273281 -677060 338530 189622 -94811 206166 -103083 -354146 177073 -503094 251547 671860 -335930 -810126 405063 -743936 371968 -799120 399560 579380 -289690 -829990 4149...

output:

+-+++-+++-+-+++++-+-+++++-+-+++-+-+-+++-+++-+++++++++++++++-+-+-+++++++++++++++++-+-+-+++++-+-+-+++++++++++++-+++++-+-+-+-+++++-+-+-+++-+++-+-+-+++++-+-+-+++-+++-+++++++-+-+++-+++-+-+-+++-+++-+-+-+++-+-+-+++-+++++-+-+++-+-+-+++++++++++++-+-+-+++-+++-+++++-+++++++++-+-+++++-+++-+-+++-+-+-+-+-+-+-+-+-...

result:

ok single line: '+-+++-+++-+-+++++-+-+++++-+-++...++-+++++-+++++-+-+++++-+-+++++-'

Test #13:

score: 0
Accepted
time: 4ms
memory: 5544kb

input:

100000
1 -836242278 418121139 779823668 -389911834 456274226 -228137113 -468926922 234463461 -674503678 337251839 -167236416 83618208 217124940 -108562470 83590374 -41795187 888634130 -444317065 -477073058 238536529 -539286006 269643003 593019232 -296509616 983037312 -491518656 -730801390 365400695 ...

output:

+-+++++-+-+-+++++++-+-+++++-+++-+++++++-+++-+++++++++-+++++++-+-+-+++++++++++-+-+-+-+-+-+++-+-+-+-+++-+++-+++-+++++++++++++++++++-+++-+-+-+-+++++++-+++-+-+-+++-+++-+++++++-+-+++++-+-+++-+-+++++-+-+++-+-+++-+-+++++++-+++++++++-+-+++-+++++++-+-+++++++-+-+-+++-+++-+-+++-+-+-+-+++-+-+-+-+-+-+++-+++++++-...

result:

ok single line: '+-+++++-+-+-+++++++-+-+++++-++...++-+++++-+-+-+++++++-+-+-+++++-'

Test #14:

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

input:

10
1 -92 -46 -46 -46 -46 -46 -46 -46 46

output:

+--------+

result:

ok single line: '+--------+'

Test #15:

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

input:

1000
1 -236388 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -1181...

output:

+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------...

result:

ok single line: '+-----------------------------...------------------------------+'

Test #16:

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

input:

100000
1 -341428024 -170714012 -170714012 -170714012 -170714012 -170714012 -170714012 -170714012 -170714012 -170714012 -170714012 -170714012 -170714012 -170714012 -170714012 -170714012 -170714012 -170714012 -170714012 -170714012 -170714012 -170714012 -170714012 -170714012 -170714012 -170714012 -1707...

output:

+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------...

result:

ok single line: '+-----------------------------...------------------------------+'

Test #17:

score: 0
Accepted
time: 2ms
memory: 5552kb

input:

100000
-480901673 -509307600 -562561206 -720747466 941874932 -338344843 -453928087 355126643 -42193930 344068464 -358448536 132560523 166795837 314061531 487526745 -156787355 611354631 116338982 -466559641 -310495789 -368174169 729138 -202574892 -453653662 -893218259 827601754 128423870 -106094115 7...

output:

----+--+++-+++++++-------+++++---++-+----++++----++++----+++++++++------++-----+++++++++--++++-++++----+-+-++----+++--+-+++--------+-++-++++-------+++++-------------+-++---+-----++--+----+------+-+-++++-+++++-+--+++---+----++++---+++----+-+-+-------++-+-+-----++-++++++-+--++-+-+++-+-++++++--++-----+...

result:

ok single line: '----+--+++-+++++++-------+++++...--++-++-+---+-++---++-++++-++++'

Test #18:

score: 0
Accepted
time: 2ms
memory: 5552kb

input:

100000
401801336 -153873233 -245401319 57736118 -371480661 -7386866 -962876999 -509105223 -97542547 312188284 -825578860 197298463 -215386150 -894478467 184851706 -973780424 -155743919 405442471 -448475678 509920273 119901780 330459500 -494037860 -200311269 791000901 -661046994 634125416 890073378 -...

output:

++-------+-------+-+++--+-++-++++++----------+-+------+--++-++++++++-+++++--++++--+-+++---++-+--++++-++---+--+----+++-+----++++-----+---++-----++-----++++++-++--+-----+++-----++++-++-+-------+-+++-+----+-++--+---+-----++++--++-++++-+++++++++--------------+-+++++++++++-++-+-----++--+--+++++-------+++...

result:

ok single line: '++-------+-------+-+++--+-++-+...+++--+--++++++----+----++++----'

Test #19:

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

input:

100000
-125561068 496528427 123636069 784342199 315163748 28603817 875018886 626662912 680133215 575275399 412323523 210158900 -892535431 -641075550 715201047 209226508 539100445 -138478419 -725359009 -374696372 902945022 417100071 -542411037 347998418 232130268 -392785534 -565205746 -460603926 -584...

output:

-+++++++++++--++++--++-++------++-+-----+-----+----+-+++-----++---+++-++++++++------------+++------+++++--+++-+++--++++-+++-+--------++-------++++-+--------++--+-++--+-+---+-+--+++++-+--+-----+-++-+++++-++++++++++-+-++--+++---++++-----++++++-+-+-+++-++++++--+++++--+--+-+++----------+--+--++++++-----...

result:

ok single line: '-+++++++++++--++++--++-++-----...+++++++++------++---+-+--------'

Test #20:

score: 0
Accepted
time: 4ms
memory: 5564kb

input:

100000
757141941 851962794 440795956 -194084426 -460134759 116472002 366069975 -237568954 -785280815 838362513 -644741390 274896840 725282583 150384453 412526008 -902733855 -227998106 -144342224 -707275045 983776776 -557101528 503740642 -833874006 601340812 -378617867 -714458662 -59504201 483686065 ...

output:

++++--+--+-++++----+-+-+---+----++-+-++++-+++++++++-++--+-+++++-++--++-----++-----+++++-+++++----++-+--+++--++++-++++-+------++-++------+++-+----------++++++++-+++++--+------++-++--+++--++-+-+-++++--++++++++-+-+-----+-----++---+-+-+++++++-+--+--++-++-++--+-++++---+--+--++-+++++----+++---+++---++--++...

result:

ok single line: '++++--+--+-++++----+-+-+---+--...---+++++++-++------------+----+'

Extra Test:

score: 0
Extra Test Passed