QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#123048#6718. Масив i частковi сумиplatelet100 ✓39ms9368kbC++173.4kb2023-07-11 17:35:512023-07-11 17:35:53

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-11 17:35:53]
  • 评测
  • 测评结果:100
  • 用时:39ms
  • 内存:9368kb
  • [2023-07-11 17:35:51]
  • 提交

answer

#include <bits/stdc++.h>
#define rep(i, l, r) for(int i = (l); i <= (r); i++)
#define per(i, r, l) for(int i = (r); i >= (l); i--)
#define mem(a, b) memset(a, b, sizeof a)
#define For(i, l, r) for(int i = (l), i##e = (r); i < i##e; i++)
#define pb push_back
#define eb emplace_back
#define SZ(x) int(x.size())
#define all(x) x.begin(), x.end()

using namespace std;
using ll = long long;

template<class T> inline T& cmin(T& a, const T& b) { if(b < a) a = b; return a; }
template<class T> inline T& cmax(T& a, const T& b) { if(a < b) a = b; return a; }
template<class... Args> void print(Args&&... args) {
    ((cout << args << ' '), ...);
}
template<class... Args> void println(Args&&... args) {
    print(args...), cout << endl;
}

const int N = 2e5 + 8;

int n, a[N];
vector<tuple<int, int, int>> ans;

struct pt { ll x, y; };
struct {
    int p;
    pt s[N];
    ll cross3(pt a, pt b, pt c) {
        return (b.x - a.x) * (c.y - b.y) - (b.y - a.y) * (c.x - b.x);
    };
    void push(pt a) {
        while(p >= 2 && cross3(s[p - 1], s[p], a) <= 0) p--;
        s[++p] = a;
    }
    int query(ll k) {
        int l = 1, r = p;
        while(l < r) {
            int m = l + r >> 1;
            s[m].y - s[m + 1].y <= (s[m].x - s[m + 1].x) * k ? r = m : l = m + 1;
        }
        return s[l].x;
    }
} A;

bool solve0() {
    bool A = 1, B = 1;
    rep(i, 1, n) A &= a[i] >= 0, B &= a[i] <= 0;
    if(A) return 1;
    if(B) return ans.eb(1, 0, 0), 1;
    return 0;
}
bool solve1() {
    int sum = 0; bool ok = 1;
    rep(i, 1, n) sum += a[i], ok &= sum >= 0;
    if(ok) return ans.eb(2, 1, n), 1;
    return 0;
}
bool solve2() {
    int sum = 0; bool ok = 1;
    rep(i, 1, n) sum += a[i], ok &= sum <= 0;
    if(ok) return ans.eb(1, 0, 0), ans.eb(2, 1, n), 1;
    int suf[N] = {};
    per(i, n, 1) suf[i] = min(suf[i + 1] + a[i], 0);
    ll sum1 = 0, sum2 = 0;
    rep(i, 1, n) {
        sum1 += a[i], sum2 += sum1;
        if(sum2 < 0) break;
        if(sum2 + suf[i + 1] >= 0)
            return ans.eb(2, 1, i), ans.eb(2, 1, n), 1;
    }
    ll p[N] = {};
    per(i, n, 1) p[i] = p[i + 1] + a[i];
    rep(i, 1, n) p[i + 1] += p[i];
    int pre = 0, lim = n + 1;
    rep(i, 1, n) if((pre += a[i]) < 0) { lim = i; break; }
    rep(r, 1, n) {
        ll s = p[r + 1] - p[r];
        A.push({r - 1, p[r - 1]});
        int x = A.query(s);
        if(x < lim & p[x] - x * s <= p[r] - r * s + suf[r + 1])
            return ans.eb(3, x + 1, r), ans.eb(2, 1, n), 1;
    }
    A.p = 0;
    return 0;
}
bool solve3() {
    int sum = 0, mx = 0, pos = 0;
    per(i, n, 1) {
        sum -= a[i];
        if(sum > mx) mx = sum, pos = i;
    }
    if((n - pos + 1) * 2 >= n)
        return ans.eb(1, 0, 0), ans.eb(2, pos, n), ans.eb(3, 1, n), 1;
    return ans.eb(3, 1, pos), ans.eb(3, 1, pos), ans.eb(2, 1, n), 1;
}
int main() {
    cin.tie(0)->sync_with_stdio(0);
    int g;
    cin >> n >> g;
    rep(i, 1, n) cin >> a[i];
    auto foo = [&](auto solve, int need) {
        rep(i, 0, 1) {
            if(solve()) {
                println(SZ(ans));
                for(auto [t, l, r] : ans) if(t == 1) println(1);
                else if(!i) println(t, l, r);
                else println(t ^ 1, n + 1 - r, n + 1 - l);
                exit(0);
            }
            if(!need) break;
            reverse(a + 1, a + n + 1);
        }
    };
    foo(solve0, 0), foo(solve1, 1), foo(solve2, 1), foo(solve3, 0);
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 14
Accepted

Test #1:

score: 14
Accepted
time: 8ms
memory: 5800kb

input:

200000 1
1 1 0 0 1 0 1 0 0 0 0 1 1 0 1 0 1 1 0 1 1 0 0 1 1 1 0 0 1 1 1 1 0 1 0 1 1 1 1 1 0 1 0 1 0 1 1 0 0 1 1 1 0 0 1 0 0 0 1 0 0 1 0 1 0 0 0 1 0 0 1 0 0 1 1 0 1 0 0 1 0 0 0 0 1 0 0 1 1 1 1 1 0 0 0 1 1 0 1 1 1 1 1 1 0 0 0 1 1 0 0 1 0 1 0 1 0 1 1 0 1 0 1 0 1 1 0 1 0 1 1 1 1 1 1 0 1 1 1 0 1 1 1 0 0 0...

output:

0 

result:

ok OK: 0 operations

Test #2:

score: 0
Accepted
time: 9ms
memory: 4184kb

input:

200000 1
-1 0 0 0 -1 0 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 0 -1 -1 0 -1 -1 0 0 0 -1 -1 0 -1 0 -1 0 -1 0 -1 -1 0 0 -1 -1 0 0 -1 -1 0 -1 -1 -1 -1 0 -1 -1 0 0 0 -1 0 -1 -1 -1 0 -1 -1 0 0 0 -1 -1 -1 -1 -1 0 0 -1 -1 0 -1 0 -1 0 -1 -1 -1 0 -1 -1 0 0 0 0 -1 -1 -1 0 0 -1 -1 -1 0 0 -1 -1 -1 0 0 -1 -1 -1 0 -...

output:

1 
1 

result:

ok OK: 1 operations

Test #3:

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

input:

200000 1
0 0 1 -1 1 1 -1 -1 0 1 -1 0 0 1 0 0 1 1 1 1 0 -1 -1 0 -1 -1 1 -1 1 1 1 1 -1 1 -1 1 1 0 -1 -1 0 1 0 0 0 0 1 1 -1 0 0 -1 -1 -1 0 0 0 1 1 1 -1 1 1 0 0 1 1 -1 1 0 0 1 1 1 1 -1 0 1 0 0 0 0 1 0 0 -1 0 -1 1 -1 0 1 -1 -1 0 0 0 -1 0 0 1 1 1 0 -1 0 1 1 1 0 1 0 0 0 -1 -1 0 -1 -1 1 -1 -1 1 1 0 1 1 1 -1...

output:

1 
2 1 200000 

result:

ok OK: 1 operations

Test #4:

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

input:

200000 1
-1 -1 -1 -1 0 1 0 -1 -1 0 -1 -1 1 0 0 -1 0 1 -1 0 -1 1 -1 0 1 1 0 1 1 1 0 0 1 -1 0 1 0 0 0 0 1 1 1 1 1 0 1 -1 1 1 0 -1 0 1 0 0 0 1 1 0 1 0 -1 -1 0 0 -1 -1 0 1 -1 -1 -1 0 1 0 0 -1 0 1 0 1 1 1 1 0 1 -1 -1 -1 0 0 0 -1 1 1 -1 -1 -1 1 0 0 -1 -1 0 -1 -1 -1 0 1 1 1 1 0 1 -1 -1 0 -1 0 0 0 -1 -1 -1 ...

output:

1 
3 1 200000 

result:

ok OK: 1 operations

Subtask #2:

score: 17
Accepted

Test #5:

score: 17
Accepted
time: 4ms
memory: 4188kb

input:

200000 2
1 1 0 0 1 0 1 0 1 1 0 1 1 1 1 0 0 0 1 1 0 0 0 1 1 0 1 0 0 0 0 0 1 0 1 0 0 1 0 1 1 1 0 0 1 1 0 0 0 0 0 0 1 1 0 1 1 0 1 0 1 0 1 1 1 0 0 1 0 0 1 1 1 1 0 0 0 0 1 1 0 0 0 1 1 0 1 0 1 1 0 0 0 0 1 1 0 1 1 1 1 0 0 0 0 1 0 0 1 0 0 0 1 1 1 0 0 1 1 0 1 1 0 1 1 1 0 0 1 0 0 0 0 0 1 1 0 0 0 1 1 0 1 0 1 0...

output:

0 

result:

ok OK: 0 operations

Test #6:

score: 0
Accepted
time: 9ms
memory: 5696kb

input:

200000 2
0 0 -1 -1 0 -1 0 0 -1 -1 0 -1 -1 0 -1 0 -1 -1 -1 -1 -1 0 0 -1 0 -1 -1 0 0 -1 -1 -1 -1 -1 -1 -1 -1 0 0 -1 -1 0 -1 -1 -1 0 -1 0 -1 0 -1 0 0 0 0 0 0 0 0 0 0 -1 0 -1 0 -1 0 0 0 -1 -1 0 0 -1 -1 -1 0 -1 -1 0 -1 -1 -1 -1 0 -1 -1 -1 0 0 -1 0 0 0 -1 -1 -1 0 0 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 0 0 0 -1 -1...

output:

1 
1 

result:

ok OK: 1 operations

Test #7:

score: 0
Accepted
time: 13ms
memory: 7004kb

input:

200000 2
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

2 
3 10032 52201 
2 1 200000 

result:

ok OK: 2 operations

Test #8:

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

input:

200000 2
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 -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 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -...

output:

2 
2 167935 199998 
3 1 200000 

result:

ok OK: 2 operations

Test #9:

score: 0
Accepted
time: 35ms
memory: 8124kb

input:

200000 2
1 1 0 0 1 0 0 0 0 0 0 0 1 0 0 -1 0 0 0 0 -1 0 -1 0 -1 0 0 0 0 -1 0 0 0 -1 0 0 0 -1 0 -1 0 0 0 0 0 0 0 -1 -1 1 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 -1 0 -1 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 -1 0 0 0 0 -1 0 0 0 1 0 0 -1 0 -1 0 0 0 0 0 -1 0 0 0 -1 -1 0 0 0 -1 0 -1 0 0 0 0 0 0 ...

output:

3 
1 
2 16 200000 
3 1 200000 

result:

ok OK: 3 operations

Test #10:

score: 0
Accepted
time: 7ms
memory: 6532kb

input:

200000 2
-1 0 1 -1 0 1 1 0 1 0 0 1 0 1 -1 1 1 -1 1 -1 -1 0 -1 -1 0 -1 0 0 0 1 1 0 -1 1 -1 0 1 0 1 -1 -1 -1 -1 1 -1 1 1 -1 1 1 -1 0 1 -1 0 -1 1 -1 0 -1 1 -1 0 1 1 1 0 -1 0 -1 -1 -1 -1 0 0 -1 1 -1 -1 0 1 -1 0 0 0 0 0 0 1 1 1 0 -1 0 -1 1 -1 1 -1 1 1 0 0 1 1 -1 1 1 -1 -1 1 0 -1 1 -1 0 0 0 -1 0 0 1 1 -1 ...

output:

2 
3 1 1135 
2 1 200000 

result:

ok OK: 2 operations

Subtask #3:

score: 18
Accepted

Dependency #2:

100%
Accepted

Test #11:

score: 18
Accepted
time: 9ms
memory: 6192kb

input:

200000 3
0 1 1 0 0 1 0 1 0 0 1 1 1 0 0 1 1 1 0 0 1 1 0 0 1 0 0 0 1 0 0 1 1 0 0 0 1 0 0 0 1 1 0 1 1 1 0 0 0 0 1 1 0 1 1 0 0 0 0 1 1 0 0 1 0 0 1 0 1 1 1 0 0 1 0 0 0 0 1 1 0 1 0 0 1 1 0 1 0 1 0 0 0 0 0 1 1 0 0 1 0 1 0 1 0 0 0 0 1 1 0 0 1 0 1 1 0 1 1 0 1 1 0 1 1 1 0 1 1 1 1 0 1 1 1 1 1 1 1 1 0 1 0 0 1 0...

output:

0 

result:

ok OK: 0 operations

Test #12:

score: 0
Accepted
time: 9ms
memory: 4168kb

input:

200000 3
0 -1 0 -1 -1 -1 0 0 -1 0 -1 -1 0 0 -1 0 0 -1 -1 -1 0 0 -1 -1 -1 0 -1 -1 0 0 -1 0 0 0 -1 -1 0 -1 0 0 0 -1 0 0 0 0 -1 0 0 0 0 0 -1 -1 -1 -1 0 -1 -1 0 0 0 -1 -1 -1 0 -1 -1 0 -1 0 -1 -1 -1 0 -1 0 -1 -1 0 -1 0 0 0 -1 -1 -1 -1 0 0 -1 -1 0 0 0 -1 0 0 -1 -1 0 0 -1 -1 0 0 0 0 0 -1 0 0 0 0 -1 -1 0 -1...

output:

1 
1 

result:

ok OK: 1 operations

Test #13:

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

input:

200000 3
-1 -1 -1 -1 1 -1 0 1 -1 0 -1 -1 -1 1 1 0 -1 0 1 -1 1 0 -1 0 0 1 -1 0 -1 0 0 -1 1 -1 1 1 -1 -1 0 -1 1 1 0 0 1 0 1 1 1 -1 0 -1 0 1 1 1 -1 -1 -1 1 -1 0 -1 0 1 -1 1 -1 -1 -1 1 0 1 1 -1 0 0 -1 1 -1 1 1 1 1 0 -1 1 -1 0 -1 -1 1 0 0 1 -1 1 -1 0 1 0 0 0 1 0 -1 -1 1 -1 -1 0 1 -1 1 1 0 0 1 0 1 0 1 1 -...

output:

1 
3 1 200000 

result:

ok OK: 1 operations

Test #14:

score: 0
Accepted
time: 7ms
memory: 6492kb

input:

193638 3
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 0 0 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 0 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 0 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 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 0 0 1...

output:

2 
2 1 625 
2 1 193638 

result:

ok OK: 2 operations

Test #15:

score: 0
Accepted
time: 9ms
memory: 8996kb

input:

200000 3
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

2 
3 13465 70916 
2 1 200000 

result:

ok OK: 2 operations

Test #16:

score: 0
Accepted
time: 13ms
memory: 8724kb

input:

200000 3
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 0 -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 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1...

output:

2 
3 3 44502 
2 1 200000 

result:

ok OK: 2 operations

Test #17:

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

input:

200000 3
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 -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 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -...

output:

2 
2 72290 168772 
3 1 200000 

result:

ok OK: 2 operations

Test #18:

score: 0
Accepted
time: 38ms
memory: 8200kb

input:

200000 3
1 1 1 0 0 0 0 0 0 0 -1 0 0 0 1 0 0 0 -1 0 -1 0 0 -1 0 -1 0 0 -1 0 0 0 0 0 -1 0 0 -1 0 0 -1 0 0 0 0 -1 0 -1 0 -1 0 -1 0 0 0 -1 0 0 1 0 0 0 1 0 0 0 0 0 0 -1 0 0 0 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 -1 0 0 0 -1 -1 0 0 0 -1 0 0 0 -1 0 0 0 0 0 -1 1 0 0 0 -1 0 -1 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 -1 0...

output:

3 
1 
2 19 200000 
3 1 200000 

result:

ok OK: 3 operations

Test #19:

score: 0
Accepted
time: 11ms
memory: 8308kb

input:

200000 3
0 -1 1 1 0 0 0 1 -1 0 1 0 -1 -1 1 -1 -1 0 -1 -1 -1 0 0 1 0 0 0 -1 0 1 -1 -1 0 0 1 1 1 0 -1 1 1 0 -1 0 -1 0 1 0 1 0 0 -1 -1 -1 0 1 -1 0 1 -1 0 0 0 0 1 0 1 1 0 -1 0 1 0 1 1 -1 -1 -1 0 0 1 0 0 -1 0 -1 1 0 0 -1 1 1 1 0 0 0 1 -1 1 -1 0 -1 1 -1 1 0 -1 1 -1 0 1 -1 1 -1 0 0 0 0 -1 1 0 1 0 -1 -1 1 -...

output:

2 
3 1 75 
2 1 200000 

result:

ok OK: 2 operations

Subtask #4:

score: 7
Accepted

Dependency #3:

100%
Accepted

Test #20:

score: 7
Accepted
time: 5ms
memory: 4168kb

input:

200000 4
1 1 1 1 0 1 0 0 1 1 1 1 1 0 1 1 1 0 1 0 0 0 1 0 0 1 1 1 0 0 0 0 0 1 1 1 0 0 1 0 0 1 0 1 1 0 1 1 0 0 0 0 1 1 0 1 0 1 1 0 0 0 1 1 1 1 0 0 1 1 1 1 1 1 1 1 0 0 0 1 1 0 1 1 1 1 1 0 1 1 0 1 0 1 1 1 0 1 0 1 1 1 1 1 1 1 0 1 1 0 1 1 0 0 0 1 1 1 1 1 1 1 0 1 0 1 0 1 1 1 0 1 0 1 1 0 0 1 1 1 1 0 1 0 1 0...

output:

0 

result:

ok OK: 0 operations

Test #21:

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

input:

200000 4
-1 -1 -1 -1 0 0 -1 -1 0 0 0 -1 0 0 -1 0 0 0 0 0 0 0 -1 0 0 -1 0 0 0 -1 0 -1 -1 0 0 -1 -1 0 -1 -1 -1 0 -1 0 -1 -1 -1 -1 0 -1 -1 -1 0 0 0 0 0 0 -1 0 -1 -1 0 -1 -1 0 0 -1 0 -1 0 0 -1 0 0 0 -1 0 0 -1 0 0 -1 0 -1 0 0 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 0 0 -1 0 -1 0 -1 0 -1 0 0 -1 0 -1 -1 0 -1 -1 0 -1 ...

output:

1 
1 

result:

ok OK: 1 operations

Test #22:

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

input:

200000 4
-1 1 1 -1 1 -1 0 -1 -1 0 0 -1 0 1 1 1 1 -1 0 -1 -1 -1 -1 0 1 -1 -1 1 -1 0 1 1 0 1 1 0 0 0 0 1 -1 1 0 0 -1 -1 -1 1 1 1 1 0 1 1 0 0 0 0 1 -1 1 0 0 1 1 -1 -1 0 1 -1 1 1 0 1 0 1 1 0 1 -1 1 0 1 0 0 1 0 0 0 1 1 0 1 1 -1 -1 0 -1 0 1 0 -1 0 1 -1 1 1 0 -1 -1 0 0 0 -1 -1 1 1 0 1 0 0 0 -1 -1 -1 -1 0 1...

output:

1 
3 1 200000 

result:

ok OK: 1 operations

Test #23:

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

input:

192074 4
1 1 1 1 1 1 1 1 1 1 1 0 1 1 0 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 0 1 1 1 1 1 0 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 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 0 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:

2 
2 1 624 
2 1 192074 

result:

ok OK: 2 operations

Test #24:

score: 0
Accepted
time: 13ms
memory: 8248kb

input:

200000 4
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

2 
3 11938 58982 
2 1 200000 

result:

ok OK: 2 operations

Test #25:

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

input:

200000 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 -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 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -...

output:

2 
2 161939 188989 
3 1 200000 

result:

ok OK: 2 operations

Test #26:

score: 0
Accepted
time: 35ms
memory: 8560kb

input:

200000 4
1 1 1 1 1 1 1 1 1 1 -1 0 0 0 0 -1 0 -1 0 0 0 -1 0 1 -1 0 0 1 -1 0 0 0 0 -1 0 -1 -1 0 0 0 -1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 -1 0 0 -1 0 0 0 -1 0 -1 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 -1 0 0 -1 0 0 0 0 -1 0 -1 0 0 -1 0 0 -1 0 0 0 0 -1 0 0 -1 0 0...

output:

3 
1 
2 11 200000 
3 1 200000 

result:

ok OK: 3 operations

Test #27:

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

input:

200000 4
0 -1 0 0 0 -1 1 1 1 0 1 1 1 -1 -1 -1 -1 -1 1 0 1 1 0 -1 0 -1 0 1 -1 0 -1 0 0 -1 1 1 -1 1 0 0 1 1 0 0 0 1 0 -1 0 -1 -1 -1 1 0 0 1 0 -1 1 1 1 1 1 0 -1 1 -1 1 1 1 0 -1 -1 0 1 1 1 1 0 0 0 0 -1 1 -1 1 0 1 -1 -1 0 1 1 -1 -1 0 0 -1 1 1 1 1 1 0 -1 0 -1 1 -1 1 0 0 1 0 -1 0 1 -1 1 0 1 1 -1 1 1 1 0 1 ...

output:

2 
3 1 70 
2 1 200000 

result:

ok OK: 2 operations

Subtask #5:

score: 7
Accepted

Test #28:

score: 7
Accepted
time: 2ms
memory: 7788kb

input:

2891 5
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 ...

output:

2 
2 1 75 
2 1 2891 

result:

ok OK: 2 operations

Test #29:

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

input:

2847 5
1 0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 0 1 0 1 1 1 1 0 1 1 1 1 1 1 1 1 0 1 0 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 0 -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 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...

output:

2 
2 1 80 
2 1 2847 

result:

ok OK: 2 operations

Test #30:

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

input:

2981 5
1 1 1 1 0 0 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 0 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 -1 -1 -1 0 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...

output:

2 
2 1 80 
2 1 2981 

result:

ok OK: 2 operations

Test #31:

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

input:

3000 5
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

2 
2 1 1456 
2 1 3000 

result:

ok OK: 2 operations

Test #32:

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

input:

3000 5
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

2 
2 1 1463 
2 1 3000 

result:

ok OK: 2 operations

Subtask #6:

score: 19
Accepted

Dependency #5:

100%
Accepted

Test #33:

score: 19
Accepted
time: 8ms
memory: 6456kb

input:

191855 6
1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 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 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1 1 1 1 1 1...

output:

2 
2 1 626 
2 1 191855 

result:

ok OK: 2 operations

Test #34:

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

input:

191982 6
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 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 0 1 1 1 1 1 1 0 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 0 1 1...

output:

2 
2 1 623 
2 1 191982 

result:

ok OK: 2 operations

Test #35:

score: 0
Accepted
time: 11ms
memory: 8548kb

input:

193538 6
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 1 1 1 0 1 1 1 1 1 1 1 1 0 1 1 1 0 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 0 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 0 1 0 1 1 1 1 1 0 1 1 1 1 1 1 0...

output:

2 
2 1 631 
2 1 193538 

result:

ok OK: 2 operations

Test #36:

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

input:

200000 6
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

2 
2 1 96885 
2 1 200000 

result:

ok OK: 2 operations

Test #37:

score: 0
Accepted
time: 9ms
memory: 8312kb

input:

200000 6
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

2 
2 1 96894 
2 1 200000 

result:

ok OK: 2 operations

Subtask #7:

score: 17
Accepted

Dependency #5:

100%
Accepted

Test #38:

score: 17
Accepted
time: 1ms
memory: 5472kb

input:

3000 7
1 0 1 0 1 1 0 0 0 0 0 1 0 1 1 1 1 0 1 1 0 1 0 0 0 1 1 1 0 0 1 0 0 1 1 1 0 0 0 1 0 1 1 1 1 1 0 1 0 0 0 1 0 0 0 0 0 1 1 0 0 1 0 0 1 1 0 1 0 1 0 1 1 0 1 0 0 0 1 1 1 1 1 1 1 1 0 0 1 0 1 0 0 1 1 1 0 1 0 0 1 1 0 1 0 0 0 1 1 1 1 1 0 1 0 1 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 1 1 1 0 1 1 1 0 0 1 1 0 0 1 1 0...

output:

0 

result:

ok OK: 0 operations

Test #39:

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

input:

3000 7
-1 0 0 1 1 0 0 0 -1 1 0 0 1 0 -1 0 0 1 -1 -1 -1 1 1 -1 1 1 0 -1 0 -1 -1 0 0 -1 -1 -1 0 0 1 1 -1 1 -1 -1 0 1 -1 -1 0 1 -1 -1 0 1 1 -1 1 1 1 -1 0 1 -1 0 -1 0 1 0 1 1 -1 1 -1 1 0 0 1 -1 0 1 1 0 -1 1 1 -1 1 0 1 0 0 -1 0 -1 0 1 1 -1 1 1 -1 1 -1 -1 -1 1 -1 -1 0 1 -1 -1 1 -1 -1 -1 -1 0 1 0 1 -1 0 -1...

output:

2 
3 1 5 
2 1 3000 

result:

ok OK: 2 operations

Test #40:

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

input:

3000 7
-1 0 0 0 0 -1 0 -1 -1 0 0 0 0 0 -1 -1 0 -1 -1 0 0 0 0 -1 -1 0 -1 0 -1 -1 -1 0 -1 -1 -1 -1 -1 0 0 -1 -1 -1 0 0 0 0 -1 0 -1 0 -1 0 -1 0 -1 0 0 -1 0 -1 0 0 0 -1 -1 0 0 -1 -1 0 0 -1 -1 0 0 -1 0 -1 0 -1 -1 -1 0 -1 -1 -1 0 0 -1 0 -1 0 -1 0 0 0 0 -1 0 -1 0 -1 -1 -1 -1 0 0 0 0 0 -1 0 0 -1 -1 -1 -1 0 ...

output:

1 
1 

result:

ok OK: 1 operations

Test #41:

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

input:

3000 7
-1 0 0 1 -1 1 -1 0 -1 1 -1 0 -1 1 1 1 0 1 -1 1 1 0 1 -1 -1 0 -1 1 0 0 -1 0 0 1 1 1 0 1 1 0 1 0 -1 0 0 -1 -1 1 1 0 0 1 1 1 -1 1 1 -1 -1 -1 -1 1 -1 -1 0 -1 0 -1 0 0 1 0 1 1 1 -1 1 0 0 0 -1 -1 0 0 1 0 1 -1 1 -1 0 1 -1 -1 0 -1 -1 0 1 0 0 -1 -1 0 -1 0 1 -1 1 -1 1 1 0 -1 1 0 0 -1 0 1 1 0 -1 1 1 1 0...

output:

1 
3 1 3000 

result:

ok OK: 1 operations

Test #42:

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

input:

3000 7
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...

output:

2 
3 132 622 
2 1 3000 

result:

ok OK: 2 operations

Test #43:

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

input:

3000 7
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 -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 -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:

2 
2 2441 2829 
3 1 3000 

result:

ok OK: 2 operations

Test #44:

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

input:

3000 7
1 1 1 1 1 0 -1 -1 0 -1 -1 -1 0 0 0 -1 0 0 1 0 0 0 0 0 0 0 0 1 -1 -1 -1 0 0 0 -1 0 -1 -1 0 1 0 -1 0 0 0 0 0 0 -1 0 0 0 -1 -1 0 -1 0 -1 0 0 0 0 0 0 -1 0 0 0 -1 0 0 0 0 -1 0 0 -1 0 0 0 -1 0 -1 0 0 0 0 -1 0 0 0 0 0 -1 -1 -1 0 0 0 0 0 -1 0 -1 0 0 -1 0 0 -1 -1 0 -1 -1 0 0 0 0 0 0 -1 -1 0 0 0 0 0 0 ...

output:

3 
1 
2 7 3000 
3 1 3000 

result:

ok OK: 3 operations

Test #45:

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

input:

3000 7
1 1 1 -1 1 0 -1 0 0 -1 0 -1 0 0 0 0 -1 0 -1 0 0 -1 -1 -1 0 0 0 0 0 -1 0 -1 0 0 0 1 0 -1 0 0 0 0 0 -1 0 -1 0 0 -1 0 -1 0 0 -1 0 0 0 0 -1 -1 0 0 -1 0 0 0 0 -1 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 -1 0 1 0 0 0 0 -1 0 -1 0 0 0 0 0 0 0 -1 0 0 0 -1 -1 0 0 0 -1 0 -1 -1 0 0 0 0 0 0 -1 -1 -1 0 0 0 -1 0 ...

output:

3 
1 
2 7 3000 
3 1 3000 

result:

ok OK: 3 operations

Test #46:

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

input:

2959 7
1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 0 -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 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -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 0 -1 -1 -1...

output:

2 
3 2885 2959 
3 1 2959 

result:

ok OK: 2 operations

Test #47:

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

input:

3000 7
0 1 1 -1 -1 1 0 -1 -1 0 0 0 0 0 1 -1 0 -1 0 0 0 1 -1 1 -1 1 0 0 1 0 1 1 -1 1 -1 1 0 1 1 1 1 1 0 0 0 1 1 1 -1 -1 0 0 0 0 0 -1 -1 -1 -1 0 -1 1 0 -1 1 0 0 0 -1 1 -1 -1 0 1 0 1 -1 1 -1 1 1 -1 0 1 -1 0 0 1 0 -1 0 0 -1 -1 -1 0 0 1 -1 0 0 -1 1 -1 -1 -1 0 -1 0 -1 -1 0 -1 1 1 1 -1 1 0 -1 0 1 1 -1 1 0 ...

output:

2 
3 1 38 
2 1 3000 

result:

ok OK: 2 operations

Subtask #8:

score: 1
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Dependency #6:

100%
Accepted

Dependency #7:

100%
Accepted

Test #48:

score: 1
Accepted
time: 11ms
memory: 8268kb

input:

200000 8
-1 -1 -1 0 -1 1 0 1 1 -1 0 0 0 0 0 -1 1 -1 1 -1 -1 0 1 0 -1 0 0 0 1 0 1 1 0 -1 -1 0 -1 1 1 -1 0 1 -1 0 0 -1 1 1 -1 0 1 -1 -1 -1 -1 1 0 1 -1 0 0 0 -1 -1 1 -1 1 0 -1 -1 -1 -1 -1 -1 0 1 0 -1 0 -1 -1 -1 -1 -1 1 1 -1 -1 0 0 1 1 -1 1 0 -1 -1 0 1 0 0 0 -1 1 -1 1 1 0 1 -1 -1 -1 -1 1 0 1 1 1 0 1 -1 ...

output:

2 
1 
2 1 200000 

result:

ok OK: 2 operations

Test #49:

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

input:

193782 8
1 -1 0 -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 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 0 -1 -1 -1...

output:

2 
3 193158 193782 
3 1 193782 

result:

ok OK: 2 operations

Test #50:

score: 0
Accepted
time: 5ms
memory: 6512kb

input:

200000 8
1 -1 0 1 -1 0 -1 1 0 0 -1 0 0 0 1 0 -1 0 0 -1 -1 1 1 0 0 0 0 0 0 1 0 0 0 0 0 1 -1 0 -1 0 1 1 0 0 -1 1 -1 -1 -1 0 -1 0 0 1 1 1 1 1 1 0 1 -1 1 1 0 -1 1 -1 0 0 0 0 0 0 -1 0 -1 1 -1 -1 0 -1 1 -1 0 1 0 -1 1 0 -1 -1 1 1 0 0 0 -1 -1 -1 1 0 -1 0 0 -1 0 1 -1 0 -1 -1 1 0 0 -1 1 1 0 1 -1 -1 1 -1 -1 1 ...

output:

2 
3 6 30 
2 1 200000 

result:

ok OK: 2 operations

Test #51:

score: 0
Accepted
time: 12ms
memory: 6568kb

input:

200000 8
0 -1 1 -1 0 0 0 -1 1 -1 1 -1 -1 1 1 0 0 1 1 0 -1 -1 1 1 1 1 -1 1 -1 0 -1 -1 0 -1 -1 -1 -1 0 -1 -1 -1 0 -1 -1 -1 0 0 0 0 0 1 1 1 -1 1 -1 -1 1 0 0 1 -1 0 -1 -1 -1 -1 1 -1 -1 -1 1 -1 1 0 1 0 -1 1 0 -1 1 0 0 1 0 -1 -1 0 0 -1 1 0 1 -1 1 -1 1 1 0 0 0 1 1 0 -1 -1 0 -1 -1 -1 -1 -1 -1 0 -1 1 1 -1 0 ...

output:

2 
3 1 382 
2 1 200000 

result:

ok OK: 2 operations

Test #52:

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

input:

200000 8
1 1 0 0 -1 1 0 -1 -1 0 0 -1 -1 0 1 0 -1 1 0 0 0 -1 1 0 0 0 -1 0 -1 0 -1 1 -1 1 0 0 0 -1 -1 0 1 -1 0 1 0 1 -1 -1 0 -1 0 1 1 1 -1 1 -1 0 -1 0 -1 1 1 1 1 0 1 0 -1 -1 0 1 -1 0 1 1 0 1 -1 -1 -1 0 1 1 -1 1 -1 0 1 0 -1 0 -1 -1 -1 1 0 -1 0 -1 1 0 0 -1 0 -1 -1 1 0 0 1 0 1 1 0 0 0 1 1 0 0 0 -1 0 0 -1...

output:

2 
3 10 78 
2 1 200000 

result:

ok OK: 2 operations

Test #53:

score: 0
Accepted
time: 11ms
memory: 7924kb

input:

200000 8
-1 0 -1 -1 0 1 0 1 0 0 0 -1 1 0 0 1 -1 1 -1 0 1 0 1 -1 1 1 -1 -1 0 0 1 -1 0 -1 0 1 -1 -1 -1 1 -1 1 0 0 1 -1 0 1 0 0 0 0 0 -1 0 1 0 1 1 0 -1 1 1 0 0 0 1 -1 -1 1 1 1 -1 -1 1 -1 1 1 0 -1 -1 1 0 -1 0 0 1 -1 1 -1 0 0 -1 0 -1 0 -1 1 1 1 1 -1 1 -1 -1 1 1 1 -1 1 0 1 1 -1 -1 1 1 -1 1 -1 0 0 -1 0 1 1...

output:

2 
3 1 67 
2 1 200000 

result:

ok OK: 2 operations

Test #54:

score: 0
Accepted
time: 12ms
memory: 6800kb

input:

200000 8
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

2 
3 10547 43497 
2 1 200000 

result:

ok OK: 2 operations

Test #55:

score: 0
Accepted
time: 13ms
memory: 8304kb

input:

200000 8
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

2 
3 22919 70162 
2 1 200000 

result:

ok OK: 2 operations

Test #56:

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

input:

200000 8
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 -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 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -...

output:

2 
2 97777 175782 
3 1 200000 

result:

ok OK: 2 operations

Test #57:

score: 0
Accepted
time: 29ms
memory: 8940kb

input:

200000 8
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 -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 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -...

output:

2 
2 139301 182130 
3 1 200000 

result:

ok OK: 2 operations

Test #58:

score: 0
Accepted
time: 39ms
memory: 8592kb

input:

200000 8
1 1 1 1 1 1 1 1 1 -1 0 -1 0 -1 -1 0 0 0 -1 0 -1 0 -1 -1 -1 0 0 -1 0 -1 0 0 0 -1 0 0 0 -1 0 0 0 -1 0 -1 0 0 0 -1 0 0 0 0 -1 -1 0 1 0 -1 -1 -1 0 0 0 0 0 0 0 0 -1 0 -1 0 0 -1 -1 -1 0 -1 -1 -1 0 0 0 0 0 0 -1 0 0 0 0 -1 0 -1 -1 0 -1 -1 -1 0 0 0 0 0 0 0 0 0 0 -1 0 1 0 0 -1 0 0 0 0 -1 0 0 -1 0 0 0...

output:

3 
1 
2 10 200000 
3 1 200000 

result:

ok OK: 3 operations

Test #59:

score: 0
Accepted
time: 39ms
memory: 9264kb

input:

200000 8
1 1 1 1 1 1 1 1 1 1 0 -1 0 0 0 -1 0 0 0 0 0 0 0 0 -1 0 -1 0 0 -1 -1 -1 0 0 0 0 -1 0 0 -1 0 0 0 0 -1 0 1 0 0 1 -1 0 0 0 -1 0 0 0 0 0 -1 -1 0 -1 0 0 0 0 0 0 0 0 0 -1 -1 0 0 -1 0 0 0 1 0 -1 -1 0 -1 0 -1 0 0 0 0 0 0 1 0 0 0 -1 -1 0 0 0 0 -1 0 -1 0 0 0 0 0 0 0 -1 0 0 0 -1 0 0 0 0 0 -1 0 0 0 0 0 ...

output:

3 
1 
2 12 200000 
3 1 200000 

result:

ok OK: 3 operations

Test #60:

score: 0
Accepted
time: 38ms
memory: 7484kb

input:

200000 8
1 1 1 1 1 1 1 1 -1 0 -1 -1 -1 -1 0 0 0 0 0 -1 0 0 0 -1 0 0 -1 -1 0 0 0 -1 -1 0 0 0 0 -1 0 0 0 0 0 0 -1 0 0 -1 -1 0 -1 0 1 0 0 0 0 0 0 1 0 0 0 0 -1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 -1 -1 -1 0 0 0 0 0 0 0 0 0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 0 -1 0 -1 0 0 -1 0 0 0 0 -1 0 0 -1 0 0 -1 0 -1...

output:

3 
1 
2 9 200000 
3 1 200000 

result:

ok OK: 3 operations

Extra Test:

score: 0
Extra Test Passed