QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#373771#5559. Guessing Gamekevinyang#AC ✓161ms58124kbC++2012.3kb2024-04-02 05:18:112024-04-02 05:18:12

Judging History

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

  • [2024-04-02 05:18:12]
  • 评测
  • 测评结果:AC
  • 用时:161ms
  • 内存:58124kb
  • [2024-04-02 05:18:11]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

/* Macros {{{ */
/*  A lot of this is from some of Benq's submissions
    [https://codeforces.com/profile/Benq]
    Ugly af to the eyes, but with vim fold its barable
    Hopefully c++20 concepts can make all this stuff must cleaner */

/* Basics {{{ */
using ll = long long;
using ld = long double;
using str = string;

using pi = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
#define mp make_pair
#define fi first
#define se second

#define arr array
#define ve vector
using vi = vector<int>;
using vll = vector<ll>;
using vld = vector<ld>;

using vpi = vector<pi>;
using vpll = vector<pll>;
using vpld = vector<pld>;

using vvi = vector<vi>;
using vvll = vector<vll>;
using vvld = vector<vld>;

using vvpi = vector<vpi>;
using vvpll = vector<vpll>;
using vvpld = vector<vpld>;

#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define sz size()
#define rsz(a) resize(a)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

#define For(i, a, b) for (int i = a; i < b; ++i)
#define Rof(i, a, b) for (int i = (b)-1; i >= (a); --i)
#define rep(a) For(_, 0, a)
#define each(a, x) for (auto &a : x)
#define reach(a, x) for (auto a = x.rbegin(); a != x.rend(); ++a)

template <typename T, typename U>
inline void cmin(T &x, U y) {
    if (y < x) x = y;
}
template <typename T, typename U>
inline void cmax(T &x, U y) {
    if (x < y) x = y;
}
/*}}}*/

/* IO {{{ */

/* Template Macros {{{ */
#define tcT template <class T
#define tcTU tcT, class U
#define tcTUU tcT, class... U
/*}}}*/

inline namespace Helpers { /*{{{*/
tcT, class = void > struct is_iterable : false_type {};
tcT > struct is_iterable<
          T, void_t<decltype(begin(declval<T>())), decltype(end(declval<T>()))>>
    : true_type {};
tcT > constexpr bool is_iterable_v = is_iterable<T>::value;

tcT, class = void > struct is_readable : false_type {};
tcT > struct is_readable<T, typename std::enable_if_t<is_same_v<
                                decltype(cin >> declval<T &>()), istream &>>>
    : true_type {};
tcT > constexpr bool is_readable_v = is_readable<T>::value;

tcT, class = void > struct is_printable : false_type {};
tcT > struct is_printable<T, typename std::enable_if_t<is_same_v<
                                 decltype(cout << declval<T>()), ostream &>>>
    : true_type {};
tcT > constexpr bool is_printable_v = is_printable<T>::value;
} /* namespace Helpers */
/*}}}*/

inline namespace Input { /*{{{*/
tcT > constexpr bool needs_input_v = !is_readable_v<T> && is_iterable_v<T>;
tcTUU > void re(T &t, U &...u);
tcTU > void re(pair<T, U> &p); /* pairs */

/* re: read{{{ */
tcT > typename enable_if<is_readable_v<T>, void>::type re(T &x) {
    cin >> x;
} /* default */
tcT > typename enable_if<needs_input_v<T>, void>::type re(
          T &i);                                   // vectors, arrays, etc...
tcTU > void re(pair<T, U> &p) { re(p.fi, p.se); }  // pairs
tcT > typename enable_if<needs_input_v<T>, void>::type re(T &i) {
    each(x, i) re(x);
}
tcTUU > void re(T &t, U &...u) {
    re(t);
    re(u...);
} /* read multiple}}} */

/* rv: resize and read vectors{{{ */
void rv(size_t) {}
tcTUU > void rv(size_t N, ve<T> &t, U &...u);
template <class... U>
void rv(size_t, size_t N2, U &...u);
tcTUU > void rv(size_t N, ve<T> &t, U &...u) {
    t.rsz(N);
    re(t);
    rv(N, u...);
}
template <class... U>
void rv(size_t, size_t N2, U &...u) {
    rv(N2, u...);
} /*}}}*/

/* dumb shortcuts to read in ints{{{ */
void decrement() {} /* subtract one from each */
tcTUU > void decrement(T &t, U &...u) {
    --t;
    decrement(u...);
}
#define ints(...)    \
    int __VA_ARGS__; \
    re(__VA_ARGS__);
#define int1(...)      \
    ints(__VA_ARGS__); \
    decrement(__VA_ARGS__); /*}}}*/
} /* namespace Input */
/*}}}*/

inline namespace ToString { /*{{{*/
tcT > constexpr bool needs_output_v = !is_printable_v<T> && is_iterable_v<T>;

/* ts: string representation to print */
tcT > typename enable_if<is_printable_v<T>, str>::type ts(T v) {
    stringstream ss;
    ss << fixed << setprecision(15) << v;
    return ss.str();
} /* default */
tcT > str bit_vec(T t) { /* bit vector to string */
    str res = "{";
    For(i, 0, t.sz) res += ts(t[i]);
    res += "}";
    return res;
}
str ts(ve<bool> v) { return bit_vec(v); }
template <size_t SZ>
str ts(bitset<SZ> b) {
    return bit_vec(b);
} /* bit vector */
tcTU > str ts(pair<T, U> p); /* pairs */
tcT > typename enable_if<needs_output_v<T>, str>::type ts(
          T v); /* vectors, arrays */
tcTU > str ts(pair<T, U> p) { return "(" + ts(p.fi) + ", " + ts(p.se) + ")"; }
tcT > typename enable_if<is_iterable_v<T>, str>::type ts_sep(T v, str sep) {
    /* convert container to string w/ separator sep */
    bool fst = 1;
    str res = "";
    for (const auto &x : v) {
        if (!fst) res += sep;
        fst = 0;
        res += ts(x);
    }
    return res;
}
tcT > typename enable_if<needs_output_v<T>, str>::type ts(T v) {
    return "{" + ts_sep(v, ", ") + "}";
}

/* for nested DS */
template <int, class T>
typename enable_if<!needs_output_v<T>, ve<str>>::type ts_lev(const T &v) {
    return {ts(v)};
}
template <int lev, class T>
typename enable_if<needs_output_v<T>, ve<str>>::type ts_lev(const T &v) {
    if (lev == 0 || !v.sz) return {ts(v)};
    ve<str> res;
    for (const auto &t : v) {
        if (res.sz) res.back() += ",";
        ve<str> tmp = ts_lev<lev - 1>(t);
        res.insert(end(res), all(tmp));
    }
    For(i, 0, res.sz) {
        str bef = " ";
        if (i == 0) bef = "{";
        res[i] = bef + res[i];
    }
    res.back() += "}";
    return res;
}
} /* namespace ToString */
/*}}}*/

inline namespace Output { /*{{{*/
template <class T>
void pr_sep(ostream &os, str, const T &t) {
    os << ts(t);
}
template <class T, class... U>
void pr_sep(ostream &os, str sep, const T &t, const U &...u) {
    pr_sep(os, sep, t);
    os << sep;
    pr_sep(os, sep, u...);
}
/* print w/ no spaces */
template <class... T>
void pr(const T &...t) {
    pr_sep(cout, "", t...);
}
/* print w/ spaces, end with newline */
void ps() { cout << "\n"; }
template <class... T>
void ps(const T &...t) {
    pr_sep(cout, " ", t...);
    ps();
}
/* debug to cerr */
template <class... T>
void dbg_out(const T &...t) {
    pr_sep(cerr, " | ", t...);
    cerr << endl;
}
void loc_info(int line, str names) {
    cerr << "Line(" << line << ") -> [" << names << "]: ";
}
template <int lev, class T>
void dbgl_out(const T &t) {
    cerr << "\n\n" << ts_sep(ts_lev<lev>(t), "\n") << "\n" << endl;
}
} /* namespace Output */
/*}}}}}}}}}*/

#include <bits/stdc++.h>
using namespace std;

// Computes the strongly connected components of a directed graph using
//     Tarjan's algorithm
// Vertices are 0-indexed
// Constructor Arguments:
//     G: a generic directed graph structure which can be weighted or unweighted,
//             though weights do not change the components
//         Required Functions:
//             operator [v] const: iterates over the adjacency list of vertex v
//                 (which is a list of ints for an unweighted graph, or a list of
//                 pair<int, T> for a weighted graph with weights of type T)
//             size() const: returns the number of vertices in the graph
//     condensationEdges: a reference to a vector of pairs that will store the
//         edges in the condensation graph when all vertices in an scc are
//         condensed into a single vertex (with an index equal to its scc id),
//         and it is guaranteed that this list of edges is sorted by the first
//         element in the pair in non decreasing order
// Fields:
//     id: a vector of the index of the scc each vertex is part of
//     components: a vector of vectors containing the vertices in each scc and
//         is sorted in reverse topological order
// In practice, has a moderate constant, faster than Kosaraju
// Time Complexity:
//     constructor: O(V + E)
// Memory Complexity: O(V)
// Tested:
//     Stress Tested
//     https://judge.yosupo.jp/problem/scc
//     https://dmoj.ca/problem/acc2p2
//     https://open.kattis.com/problems/watchyourstep
struct SCC {
    int ind, top; vector<int> id, low, stk; vector<vector<int>> components;
    int getTo(int e) { return e; }
    template <class T> int getTo(const pair<int, T> &e) { return e.first; }
    template <class Digraph> void dfs(const Digraph &G, int v) {
        id[stk[top++] = v] = -1; int mn = low[v] = ind++; for (auto &&e : G[v]) {
            int w = getTo(e); if (id[w] == -2) dfs(G, w);
            mn = min(mn, low[w]);
        }
        if (mn < low[v]) { low[v] = mn; return; }
        int w; components.emplace_back(); do {
            id[w = stk[--top]] = components.size() - 1; low[w] = INT_MAX;
            components.back().push_back(w);
        } while (w != v);
    }
    template <class Digraph> SCC(const Digraph &G)
            : ind(0), top(0), id(G.size(), -2), low(G.size()), stk(G.size()) {
        for (int v = 0; v < (int)G.size(); v++) if (id[v] == -2) dfs(G, v);
    }
    template <class Digraph>
    SCC(const Digraph &G, vector<pair<int, int>> &condensationEdges) : SCC(G) {
        vector<int> last(components.size(), -1);
        for (auto &&comp : components) for (int v : comp) for (auto &&e : G[v]) {
            int w = getTo(e); if (id[v] != id[w] && last[id[w]] != id[v])
                condensationEdges.emplace_back(last[id[w]] = id[v], id[w]);
        }
    }
};

int const D = 7;
int n;

arr<int, D> ds;
arr<int, 8> dpfx;

ve<arr<int, D>> friends;
arr<int, 2> my_guess;

vvi implications;

void solve() {
    re(n, ds), rv(n, friends), re(my_guess);

    dpfx[0] = 0;
    for(int i=1; i<=D; ++i) dpfx[i] = dpfx[i-1]+ds[i-1]+1;

    // implications for const i winning on day d is
    // implications[i + dpfx[d]]

    // implications for const i losing on day d is
    // implications[i + dpfx[d] + dpfx[7]]

    // implications for const i not winning on day d is
    // implications[i + dpfx[d] + 2dpfx[7]]

    // implications for const i not losing on day d is
    // implications[i + dpfx[d] + dpfx[7] + 2dpfx[7]]

    int siz = 4*dpfx[7] + 100;

    implications.assign(siz, vi());

    for(int d=0; d<D; ++d) {
        for(int i=1; i<=ds[d]; ++i) {
            int i1 = abs(i) + dpfx[d] + (i < 0)*dpfx[7];
            int i2 = abs(-i) + dpfx[d] + (-i < 0)*dpfx[7];
            int i3 = abs(i) + dpfx[d] + (i < 0)*dpfx[7] + 2*dpfx[7];
            int i4 = abs(-i) + dpfx[d] + (-i < 0)*dpfx[7] + 2*dpfx[7];

            // winning is the same as not losing
            implications[i1].pb(i4);
            implications[i4].pb(i1);

            // losing is the same as not winning
            implications[i2].pb(i3);
            implications[i3].pb(i2);
        }
    }

    for(auto f : friends) {
        for(int d=0; d<D; ++d) {
            for(int bd=0; bd<D; ++bd) {
                if(d == bd) continue;

                int dind = abs(f[d]) + dpfx[d] + (f[d] < 0)*dpfx[7];
                int nbdind = abs(f[bd]) + dpfx[bd] + (f[bd] < 0)*dpfx[7] + 2*dpfx[7];
                implications[dind].pb(nbdind);
            }
        }
    }

    for(int d=5; d<D; ++d) {
        // I must be correct
        int right = abs(my_guess[d-5]) + dpfx[d] + (my_guess[d-5] < 0)*dpfx[7];
        int not_right = abs(my_guess[d-5]) + dpfx[d] + (my_guess[d-5] < 0)*dpfx[7] + 2*dpfx[7];
        implications[not_right].pb(right);
    }

    SCC my_scc(implications);


    for(int i=0; i+2*dpfx[7]<implications.sz; ++i) {
        int good = i;
        int bad = (i+2*dpfx[7]);
        if(my_scc.id[good] == my_scc.id[bad]) { ps("impossible"); return; }
    }

    ps("possible");
}


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    /* cout << fixed << setprecision(6); */
    int t = 1;
    // cin >> t;
    for (int i = 0; i < t; i++) solve();

    return 0;
    // you should actually read the stuff at the bottom
}

/* stuff you should look for
 * int overflow, array bounds
 * special cases (n=1?)
 * do smth instead of nothing and stay organized
 * WRITE STUFF DOWN
 * DON'T GET STUCK ON ONE APPROACH
 */

詳細信息

Test #1:

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

input:

3
4 4 4 4 4 4 4
1 1 1 1 4 -2 1
2 2 2 2 -4 1 -1
3 3 3 3 -3 3 3
-2 -1

output:

impossible

result:

ok single line: 'impossible'

Test #2:

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

input:

3
4 4 4 4 4 4 4
4 3 2 1 4 1 1
2 4 4 2 2 4 2
2 3 3 4 1 3 2
-2 -1

output:

possible

result:

ok single line: 'possible'

Test #3:

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

input:

4
1 1 1 1 1 1 1
-1 -1 -1 -1 1 1 -1
-1 1 1 1 -1 -1 1
-1 -1 1 -1 -1 -1 1
-1 -1 -1 -1 -1 1 -1
-1 -1

output:

impossible

result:

ok single line: 'impossible'

Test #4:

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

input:

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

output:

impossible

result:

ok single line: 'impossible'

Test #5:

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

input:

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

output:

impossible

result:

ok single line: 'impossible'

Test #6:

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

input:

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

output:

impossible

result:

ok single line: 'impossible'

Test #7:

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

input:

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

output:

possible

result:

ok single line: 'possible'

Test #8:

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

input:

4
3 3 3 3 3 3 3
1 -2 -1 3 1 2 1
3 -2 2 -1 2 3 1
3 1 3 -2 2 1 1
-2 -1 3 1 1 3 3
-3 -3

output:

possible

result:

ok single line: 'possible'

Test #9:

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

input:

1000
500 20 20 500 500 500 10
-115 -19 7 431 92 -225 10
-158 14 -8 -87 412 -60 8
160 -5 1 -416 -264 -372 -10
404 -9 -6 -438 383 396 8
170 -7 2 4 -285 -149 -4
338 -9 6 -173 354 -485 -6
483 -6 -3 -361 58 3 -3
246 -8 -4 122 172 -212 10
-188 6 -4 -60 -483 -222 -1
-366 -18 1 -117 -256 -419 -10
212 -2 -14...

output:

impossible

result:

ok single line: 'impossible'

Test #10:

score: 0
Accepted
time: 3ms
memory: 4560kb

input:

1000
500 20 20 500 500 500 10
180 -12 18 184 324 39 8
-441 -20 -11 182 422 270 5
321 -5 14 -15 53 490 1
-496 -12 14 -15 262 -31 -6
250 -19 7 -324 203 -210 8
68 -15 -7 92 131 480 1
-373 14 5 52 -347 -124 8
46 3 -17 162 394 47 -7
417 -6 3 -173 -33 111 9
-46 -13 -2 138 491 398 -10
-498 17 9 202 -344 33...

output:

impossible

result:

ok single line: 'impossible'

Test #11:

score: 0
Accepted
time: 77ms
memory: 37128kb

input:

40000
5000 5000 5000 5000 5000 5000 5000
4712 -4246 -3569 -2508 -502 -3965 1152
4221 -1238 -502 3638 -1816 -785 -484
-284 -1802 2845 940 -7 3329 319
-4869 -2196 -1187 -3358 -977 -4598 1464
2731 1530 -889 1697 -650 -3009 2293
2985 -1348 -3496 -3319 -4620 -941 -4068
3380 4323 -3622 3803 1999 -1527 347...

output:

impossible

result:

ok single line: 'impossible'

Test #12:

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

input:

50000
1 1 1 1 1 1 4994
-1 1 1 -1 -1 1 3938
-1 1 1 -1 -1 1 -1193
1 -1 1 1 1 1 1739
-1 1 1 -1 1 -1 4977
1 -1 -1 1 1 -1 -4624
-1 1 -1 1 -1 -1 718
-1 -1 1 -1 -1 -1 -3181
1 1 -1 -1 -1 1 -3473
1 1 -1 -1 -1 -1 544
1 1 1 1 -1 -1 -677
1 1 -1 1 1 1 4701
-1 1 1 1 -1 -1 -4164
-1 -1 -1 1 1 1 -472
1 1 1 1 1 1 -35...

output:

impossible

result:

ok single line: 'impossible'

Test #13:

score: 0
Accepted
time: 26ms
memory: 15108kb

input:

50000
1 1 1 1 1 1 4994
1 -1 1 1 1 -1 4090
-1 -1 1 1 1 -1 1070
1 -1 1 -1 -1 1 2518
1 1 -1 -1 -1 1 -588
-1 -1 -1 1 1 -1 894
-1 1 1 1 1 1 -216
1 1 1 -1 1 1 -3055
1 -1 1 1 1 1 3376
1 1 -1 -1 1 1 -428
-1 1 1 1 -1 -1 -1420
-1 1 1 -1 1 1 4025
1 -1 -1 -1 1 1 3713
1 -1 1 1 -1 -1 -4496
-1 1 -1 -1 1 1 -790
1 1...

output:

impossible

result:

ok single line: 'impossible'

Test #14:

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

input:

10000
1000 1000 1000 1000 1000 1000 1000
-279 -71 970 583 -485 -256 -439
-459 303 -784 -636 -503 -560 -91
-947 923 329 -961 989 -118 -531
-659 -458 -523 -320 -425 963 -595
73 -868 -742 976 81 -595 216
332 -685 883 657 708 182 797
758 -395 672 -232 412 150 639
81 525 858 -888 843 -175 -819
-686 897 4...

output:

impossible

result:

ok single line: 'impossible'

Test #15:

score: 0
Accepted
time: 6ms
memory: 10956kb

input:

10000
1000 1000 1000 1000 1000 1000 1000
998 1000 -200 -901 622 941 -362
-608 -330 366 544 -341 -428 -318
-302 435 -114 -233 -777 -735 -295
-421 896 -424 606 -33 -496 -601
245 -41 -535 747 -330 443 -365
-289 643 -866 -976 325 -49 99
-186 127 189 100 528 257 -574
-780 -955 -241 -568 -800 -722 663
-37...

output:

impossible

result:

ok single line: 'impossible'

Test #16:

score: 0
Accepted
time: 32ms
memory: 23272kb

input:

50000
1000 1000 1000 1000 1000 1000 1000
-305 862 -527 463 -204 199 -158
805 -733 614 528 996 917 316
-273 -334 -698 862 -811 49 432
159 99 822 906 485 -881 402
-820 373 -462 -111 -869 684 -609
-480 -112 842 -370 900 683 -429
-653 472 -620 -200 -85 -490 -709
-964 -310 740 491 28 710 -972
-811 -617 -...

output:

impossible

result:

ok single line: 'impossible'

Test #17:

score: 0
Accepted
time: 118ms
memory: 58068kb

input:

50000
10000 10000 10000 10000 10000 10000 10000
6033 4235 8203 7263 -4695 -801 -2308
7461 2512 -9858 -2039 -2807 -8160 9562
-5427 -9345 -3202 -324 -1624 -9303 6654
-2998 3627 3038 5527 9830 -6543 -2317
-3632 9282 7248 -8264 7907 -5347 3574
-8529 -8453 7626 -8725 -5318 -3811 -5914
-4216 -8639 8663 25...

output:

impossible

result:

ok single line: 'impossible'

Test #18:

score: 0
Accepted
time: 161ms
memory: 58124kb

input:

50000
10000 10000 10000 10000 10000 10000 10000
-6529 -348 3680 3690 -2720 -8171 -6717
-535 -373 2263 -4067 303 9944 -5267
-6959 -1454 557 -443 -3818 6226 -6972
-3941 -5436 -7139 4971 6426 -5649 -8255
1805 -2129 5339 651 -9840 -4942 -2774
-8623 2367 -773 -9162 2835 3571 -782
-3902 -8742 9320 4626 -8...

output:

impossible

result:

ok single line: 'impossible'

Test #19:

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

input:

1000
500 20 20 500 500 500 10
-54 -10 8 -82 -205 500 2
320 8 -9 133 50 415 -6
-311 3 8 -404 -451 -293 2
-249 20 -14 314 90 154 3
406 9 -14 274 -352 277 10
-197 20 11 57 -445 248 3
-357 -5 -16 -407 -499 415 -2
-89 14 6 -240 -464 344 2
-395 -15 -17 135 421 47 3
425 -15 18 -32 388 65 -4
144 20 -7 373 -...

output:

possible

result:

ok single line: 'possible'

Test #20:

score: 0
Accepted
time: 3ms
memory: 4328kb

input:

1000
500 20 20 500 500 500 10
-137 -8 -6 254 69 65 -9
467 -5 19 436 -293 -264 1
-191 -4 -6 -500 184 428 -3
13 -3 1 -464 -495 170 9
109 -6 -16 42 200 313 6
310 -13 -17 349 -440 -328 4
-63 2 -17 356 183 306 -3
166 12 -5 -331 488 303 4
458 7 -14 -213 349 324 -9
-124 -20 -15 19 -153 413 5
168 1 -8 166 -...

output:

possible

result:

ok single line: 'possible'

Test #21:

score: 0
Accepted
time: 70ms
memory: 29292kb

input:

40000
5000 5000 5000 5000 5000 5000 5000
-4893 1892 2422 4622 4524 4363 -4142
466 2253 978 -3262 3229 108 -1053
499 4634 383 3075 2233 4548 -2178
3690 3227 3851 3581 -2395 -3853 -425
1586 2557 -4469 1866 -1656 594 -1014
4824 -1607 -73 3522 4001 -2867 3505
2127 -2402 -677 2719 -1120 989 2882
3900 172...

output:

possible

result:

ok single line: 'possible'

Test #22:

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

input:

50000
1 1 1 1 1 1 4994
1 1 -1 1 1 1 -1176
1 1 1 1 -1 1 4914
1 1 1 1 1 -1 1154
-1 1 1 1 1 1 -1948
-1 1 1 1 1 1 -835
1 1 1 1 -1 1 866
1 -1 1 1 1 1 2221
1 -1 1 1 1 1 1113
1 1 1 -1 1 1 378
1 1 1 1 1 1 754
1 1 1 1 1 1 3372
1 -1 1 1 1 1 3415
1 1 1 1 1 -1 1287
1 1 1 1 1 1 -2395
1 1 1 1 1 1 -4023
1 1 1 -1 1...

output:

possible

result:

ok single line: 'possible'

Test #23:

score: 0
Accepted
time: 25ms
memory: 15208kb

input:

50000
1 1 1 1 1 1 4994
1 1 -1 1 1 1 312
1 1 1 1 1 -1 3329
1 1 1 1 1 1 -1972
1 1 1 1 1 1 1627
1 1 1 1 -1 1 -2669
1 1 1 1 1 1 -1481
1 -1 1 1 1 1 -1933
1 1 1 1 1 1 2874
1 1 1 1 1 -1 -3358
-1 1 1 1 1 1 -4658
1 1 1 1 1 1 2594
1 1 -1 1 1 1 -2721
1 1 1 1 1 -1 -1636
1 1 1 1 -1 1 -2193
1 1 -1 1 1 1 4232
1 1 ...

output:

possible

result:

ok single line: 'possible'

Test #24:

score: 0
Accepted
time: 14ms
memory: 9320kb

input:

10000
1000 1000 1000 1000 1000 1000 1000
-980 -599 793 -876 482 135 -236
491 -316 624 216 767 368 297
-382 -313 -995 231 -776 -180 395
888 131 186 916 484 -26 899
329 524 494 -203 63 35 -231
549 -885 587 785 -294 -391 8
-272 515 -215 -215 45 -986 710
530 379 746 -405 -779 429 587
-308 -54 72 -368 -2...

output:

possible

result:

ok single line: 'possible'

Test #25:

score: 0
Accepted
time: 10ms
memory: 9304kb

input:

10000
1000 1000 1000 1000 1000 1000 1000
735 -241 193 811 -849 -939 574
278 441 -55 -297 670 -962 -736
-292 -337 635 829 24 83 -398
-558 738 -857 -350 -335 -396 420
-883 -836 519 382 -155 67 -611
479 700 104 126 880 -164 -93
-923 -302 -721 -434 581 992 -792
89 -359 -91 18 737 72 924
-91 876 454 -96 ...

output:

possible

result:

ok single line: 'possible'

Test #26:

score: 0
Accepted
time: 34ms
memory: 22700kb

input:

50000
1000 1000 1000 1000 1000 1000 1000
-210 -637 -580 -718 963 869 -504
291 -413 854 149 907 787 877
-627 -503 -22 -162 -748 385 -451
825 864 -373 -652 -445 110 -50
-403 452 481 666 -437 960 -819
-532 200 867 -582 824 463 86
296 -979 227 472 -314 -925 -556
96 892 158 899 -759 -938 442
-227 973 855...

output:

possible

result:

ok single line: 'possible'

Test #27:

score: 0
Accepted
time: 143ms
memory: 44708kb

input:

50000
10000 10000 10000 10000 10000 10000 10000
7609 -179 -9580 -833 6450 8118 8678
2291 2666 8828 8551 -7811 2981 -3673
1283 -1304 -4355 -3583 7620 -2662 8961
8685 4966 527 2502 2186 -6466 -9008
2264 -2613 1111 7901 -7860 4890 -8755
-5050 1843 4794 3092 -3203 -3789 7703
7739 -1256 9650 -5023 -7033 ...

output:

possible

result:

ok single line: 'possible'

Test #28:

score: 0
Accepted
time: 144ms
memory: 44812kb

input:

50000
10000 10000 10000 10000 10000 10000 10000
3986 -3862 7759 -8718 7314 2910 -636
6646 9909 3091 -7731 -3490 9620 -9659
4841 -8674 -4827 -6804 4302 -1915 -5638
-9307 4332 -2457 6013 -1670 6815 -9194
2690 3526 -2657 6787 -8759 -6658 -5441
-1813 526 8450 -5920 8097 9944 -8841
-9299 7151 4117 2383 -...

output:

possible

result:

ok single line: 'possible'

Test #29:

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

input:

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

output:

impossible

result:

ok single line: 'impossible'

Test #30:

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

input:

3
3 3 3 3 3 3 3
3 1 2 1 3 1 2
-2 -1 2 3 -1 3 2
2 3 1 2 3 -1 2
3 2

output:

impossible

result:

ok single line: 'impossible'