QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#297064#6718. Масив i частковi сумиcmk666100 ✓26ms8256kbC++239.8kb2024-01-03 22:02:552024-01-03 22:02:56

Judging History

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

  • [2024-01-03 22:02:56]
  • 评测
  • 测评结果:100
  • 用时:26ms
  • 内存:8256kb
  • [2024-01-03 22:02:55]
  • 提交

answer

/*
 * @Author:             cmk666
 * @Created time:       2024-01-03 20:50:33
 * @Last Modified time: 2024-01-03 22:02:38
 */
#pragma GCC optimize("Ofast", "unroll-loops")
#include<bits/stdc++.h>
#ifdef LOCAL
#include"debug.h"
#else
#define D(...) ((void)0)
#endif
using namespace std; using ll = long long;
#define For(i, j, k) for ( int i = (j) ; i <= (k) ; i++ )
#define Fol(i, j, k) for ( int i = (j) ; i >= (k) ; i-- )
namespace FastIO
{
// ------------------------------
#define IN_HAS_NEG
// #define OUT_HAS_NEG
// #define CHK_EOF
// #define DISABLE_MMAP
// ------------------------------
#if __cplusplus < 201400
#error Please use C++14 or higher.
#endif
#if __cplusplus > 201700
#define INLINE_V inline
#else
#define INLINE_V
#endif
#if ( defined(LOCAL) || defined(_WIN32) ) && !defined(DISABLE_MMAP)
#define DISABLE_MMAP
#endif
#ifndef DISABLE_MMAP
#include<sys/mman.h>
#endif
#ifdef LOCAL
	inline char gc() { return getchar(); }
	inline void pc(char c) { putchar(c); }
#else
#ifdef DISABLE_MMAP
	INLINE_V constexpr int _READ_SIZE = 1 << 18;
	INLINE_V static char _read_buffer[_READ_SIZE], *_read_ptr = nullptr, *_read_ptr_end = nullptr;
	inline char gc()
	{
		if ( __builtin_expect(_read_ptr == _read_ptr_end, false) )
		{
			_read_ptr = _read_buffer;
			_read_ptr_end = _read_buffer + fread(_read_buffer, 1, _READ_SIZE, stdin);
#ifdef CHK_EOF
			if ( __builtin_expect(_read_ptr == _read_ptr_end, false) ) return EOF;
#endif
		}
		return *_read_ptr++;
	}
#else
	INLINE_V static const char *_read_ptr = (const char *)mmap(nullptr, INT_MAX, 1, 2, 0, 0);
	inline char gc() { return *_read_ptr++; }
#endif
	INLINE_V constexpr int _WRITE_SIZE = 1 << 18;
	INLINE_V static char _write_buffer[_WRITE_SIZE], *_write_ptr = _write_buffer;
	inline void pc(char c)
	{
		*_write_ptr++ = c;
		if ( __builtin_expect(_write_buffer + _WRITE_SIZE == _write_ptr, false) )
		{
			fwrite(_write_buffer, 1, _write_ptr - _write_buffer, stdout);
			_write_ptr = _write_buffer;
		}
	}
	INLINE_V struct _auto_flush
	{
		inline ~_auto_flush() { fwrite(_write_buffer, 1, _write_ptr - _write_buffer, stdout); }
	}	_auto_flush;
#endif
#ifdef CHK_EOF
	inline constexpr bool _isdigit(char c) { return ( c & 16 ) && c != EOF; }
	inline constexpr bool _isgraph(char c) { return c > 32 && c != EOF; }
#else
	inline constexpr bool _isdigit(char c) { return c & 16; }
	inline constexpr bool _isgraph(char c) { return c > 32; }
#endif
	template < class T >
	INLINE_V constexpr bool _is_integer = numeric_limits < T >::is_integer;
	template < class T >
	INLINE_V constexpr bool _is_signed = numeric_limits < T >::is_signed;
	template < class T >
	INLINE_V constexpr bool _is_unsigned = _is_integer < T > && !_is_signed < T >;
	template <> INLINE_V constexpr bool _is_integer < __int128 > = true;
	template <> INLINE_V constexpr bool _is_integer < __uint128_t > = true;
	template <> INLINE_V constexpr bool _is_signed < __int128 > = true;
	template <> INLINE_V constexpr bool _is_unsigned < __uint128_t > = true;
#undef INLINE_V
	inline void read(char &c) { do c = gc(); while ( !_isgraph(c) ); }
	inline void read_cstr(char *s)
	{
		char c = gc(); while ( !_isgraph(c) ) c = gc();
		while ( _isgraph(c) ) *s++ = c, c = gc();
		*s = 0;
	}
	inline void read(string &s)
	{
		char c = gc(); s.clear(); while ( !_isgraph(c) ) c = gc();
		while ( _isgraph(c) ) s.push_back(c), c = gc();
	}
#ifdef IN_HAS_NEG
	template < class T, enable_if_t < _is_signed < T >, int > = 0 >
	inline void read(T &x)
	{
		char c = gc(); bool f = true; x = 0;
		while ( !_isdigit(c) ) { if ( c == 45 ) f = false; c = gc(); }
		if ( f ) while ( _isdigit(c) ) x = x * 10 + ( c & 15 ), c = gc();
		else     while ( _isdigit(c) ) x = x * 10 - ( c & 15 ), c = gc();
	}
	template < class T, enable_if_t < _is_unsigned < T >, int > = 0 >
#else
	template < class T, enable_if_t < _is_integer < T >, int > = 0 >
#endif
	inline void read(T &x)
	{
		char c = gc(); while ( !_isdigit(c) ) c = gc();
		x = 0; while ( _isdigit(c) ) x = x * 10 + ( c & 15 ), c = gc();
	}
	inline void write(char c) { pc(c); }
	inline void write_cstr(const char *s) { while ( *s ) pc(*s++); }
	inline void write(const string &s) { for ( char c : s ) pc(c); }
#ifdef OUT_HAS_NEG
	template < class T, enable_if_t < _is_signed < T >, int > = 0 >
	inline void write(T x)
	{
		char buffer[numeric_limits < T >::digits10 + 1]; int digits = 0;
		if ( x >= 0 )  do buffer[digits++] =  ( x % 10 ) | 48, x /= 10; while ( x );
		else { pc(45); do buffer[digits++] = -( x % 10 ) | 48, x /= 10; while ( x ); }
		while ( digits ) pc(buffer[--digits]);
	}
	template < class T, enable_if_t < _is_unsigned < T >, int > = 0 >
#else
	template < class T, enable_if_t < _is_integer < T >, int > = 0 >
#endif
	inline void write(T x)
	{
		char buffer[numeric_limits < T >::digits10 + 1]; int digits = 0;
		do buffer[digits++] = ( x % 10 ) | 48, x /= 10; while ( x );
		while ( digits ) pc(buffer[--digits]);
	}
	template < int N > struct _tuple_io_helper
	{
		template < class ...T >
		static inline void _read(tuple < T... > &x)
		{ _tuple_io_helper < N - 1 >::_read(x), read(get < N - 1 > (x)); }
		template < class ...T >
		static inline void _write(const tuple < T... > &x)
		{ _tuple_io_helper < N - 1 >::_write(x), pc(32), write(get < N - 1 > (x)); }
	};
	template <> struct _tuple_io_helper < 1 >
	{
		template < class ...T >
		static inline void _read(tuple < T... > &x) { read(get < 0 > (x)); }
		template < class ...T >
		static inline void _write(const tuple < T... > &x) { write(get < 0 > (x)); }
	};
	template < class ...T >
	inline void read(tuple < T... > &x) { _tuple_io_helper < sizeof...(T) >::_read(x); }
	template < class ...T >
	inline void write(const tuple < T... > &x) { _tuple_io_helper < sizeof...(T) >::_write(x); }
	template < class T1, class T2 >
	inline void read(pair < T1, T2 > &x) { read(x.first), read(x.second); }
	template < class T1, class T2 >
	inline void write(const pair < T1, T2 > &x) { write(x.first), pc(32), write(x.second); }
	template < class T1, class ...T2 >
	inline void read(T1 &x, T2 &...y) { read(x), read(y...); }
	template < class ...T >
	inline void read_cstr(char *x, T *...y) { read_cstr(x), read_cstr(y...); }
	template < class T1, class ...T2 >
	inline void write(const T1 &x, const T2 &...y) { write(x), write(y...); }
	template < class ...T >
	inline void write_cstr(const char *x, const T *...y) { write_cstr(x), write_cstr(y...); }
	template < class T >
	inline void print(const T &x) { write(x); }
	inline void print_cstr(const char *x) { write_cstr(x); }
	template < class T1, class ...T2 >
	inline void print(const T1 &x, const T2 &...y) { print(x), pc(32), print(y...); }
	template < class ...T >
	inline void print_cstr(const char *x, const T *...y) { print_cstr(x), pc(32), print_cstr(y...); }
	inline void println() { pc(10); }
	inline void println_cstr() { pc(10); }
	template < class ...T >
	inline void println(const T &...x) { print(x...), pc(10); }
	template < class ...T >
	inline void println_cstr(const T *...x) { print_cstr(x...), pc(10); }
}
using namespace FastIO;
int _, n, a[200009], s[200009], t[200009], p, q; ll ss[200009], sum;
vector < int > stk; bool flg;
inline int f(int x) { return flg ? -x : x; }
inline void clr() { stk.clear(); }
inline void ins(int x)
{
	while ( (int)stk.size() > 1 &&
			( ss[x] - ss[stk.back()] ) * f(stk.back() - stk[(int)stk.size() - 2]) <
			( ss[stk.back()] - ss[stk[(int)stk.size() - 2]] ) * f(x - stk.back()) )
		stk.pop_back();
	stk.push_back(x);
}
inline int qry(int x)
{
	int l = 0, r = (int)stk.size() - 1, md;
	while ( l < r )
		md = ( l + r ) >> 1,
		ss[stk[md + 1]] - ss[stk[md]] >= (ll)x * f(stk[md + 1] - stk[md]) ? r = md : l = md + 1;
	return stk[l];
}
int main()
{
	read(n, _), stk.reserve(n);
	For(i, 1, n) read(a[i]);
	if ( *min_element(a + 1, a + n + 1) >= 0 ) return println(0), 0;
	if ( *max_element(a + 1, a + n + 1) <= 0 ) return println(1), println(1), 0;
	For(i, 1, n) s[i] = s[i - 1] + a[i];
	if ( *min_element(s + 1, s + n + 1) >= 0 ) return println(1), println(2, 1, n), 0;
	Fol(i, n, 1) s[i] = s[i + 1] + a[i];
	if ( *min_element(s + 1, s + n + 1) >= 0 ) return println(1), println(3, 1, n), 0;
	For(i, 1, n) s[i] = s[i - 1] - a[i];
	if ( *min_element(s + 1, s + n + 1) >= 0 ) return println(2), println(1), println(2, 1, n), 0;
	Fol(i, n, 1) s[i] = s[i + 1] - a[i];
	if ( *min_element(s + 1, s + n + 1) >= 0 ) return println(2), println(1), println(3, 1, n), 0;
	sum = 0, p = n + 1, clr();
	For(i, 1, n) s[i] = s[i - 1] + a[i];
	Fol(i, n, 1) t[i] = min(0, t[i + 1] + a[i]);
	For(i, 1, n)
		if ( ( sum += s[i] ) < 0 ) break;
		else if ( sum + t[i + 1] >= 0 ) return println(2), println(2, 1, i), println(2, 1, n), 0;
	For(i, 1, n) if ( s[i] < 0 ) { p = i; break; }
	Fol(i, n, 1) s[i] = s[i + 1] + a[i];
	For(i, 1, n) ss[i] = ss[i - 1] + s[i];
	For(i, 1, n)
	{
		ins(i - 1), q = qry(s[i + 1]);
		if ( q < p && ss[i] - ss[q] + t[i + 1] >= (ll)( i - q ) * s[i + 1] )
			return println(2), println(3, q + 1, i), println(2, 1, n), 0;
	}
	sum = p = 0, clr(), flg = true;
	Fol(i, n, 1) s[i] = s[i + 1] + a[i];
	For(i, 1, n) t[i] = min(0, t[i - 1] + a[i]);
	Fol(i, n, 1)
		if ( ( sum += s[i] ) < 0 ) break;
		else if ( sum + t[i - 1] >= 0 ) return println(2), println(3, i, n), println(3, 1, n), 0;
	Fol(i, n, 1) if ( s[i] < 0 ) { p = i; break; }
	For(i, 1, n) s[i] = s[i - 1] + a[i];
	Fol(i, n, 1) ss[i] = ss[i + 1] + s[i];
	Fol(i, n, 1)
	{
		ins(i + 1), q = qry(s[i - 1]);
		if ( q > p && ss[i] - ss[q] + t[i - 1] >= (ll)( q - i ) * s[i - 1] )
			return println(2), println(2, i, q - 1), println(3, 1, n), 0;
	}
	p = max_element(s + 1, s + n + 1) - s;
	return println(3), println(1), println(2, p + 1, n), println(3, 1, n), 0;
}
// 想上GM捏 想上GM捏 想上GM捏 想上GM捏 想上GM捏
// 伊娜可爱捏 伊娜贴贴捏

详细

Subtask #1:

score: 14
Accepted

Test #1:

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

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: 0ms
memory: 4944kb

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: 2ms
memory: 6016kb

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: 2ms
memory: 6632kb

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: 1ms
memory: 6576kb

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: 2ms
memory: 4756kb

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: 6ms
memory: 8072kb

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: 14ms
memory: 8256kb

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: 23ms
memory: 7952kb

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

result:

ok OK: 3 operations

Test #10:

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

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: 1ms
memory: 4740kb

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: 2ms
memory: 6212kb

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: 2ms
memory: 6020kb

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: 3ms
memory: 6964kb

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: 8ms
memory: 8000kb

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: 6ms
memory: 8132kb

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: 22ms
memory: 8016kb

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: 26ms
memory: 8020kb

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

result:

ok OK: 3 operations

Test #19:

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

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: 1ms
memory: 6148kb

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: 2ms
memory: 4940kb

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: 2ms
memory: 5504kb

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: 6372kb

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: 0ms
memory: 8012kb

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: 9ms
memory: 8212kb

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: 19ms
memory: 7940kb

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: 5ms
memory: 7840kb

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: 1ms
memory: 5624kb

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: 5684kb

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: 1ms
memory: 5748kb

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: 0ms
memory: 3620kb

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: 5684kb

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: 3ms
memory: 6416kb

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: 0ms
memory: 6404kb

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: 4ms
memory: 6348kb

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: 3ms
memory: 6796kb

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: 0ms
memory: 8092kb

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: 5676kb

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: 0ms
memory: 3740kb

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: 5580kb

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: 0ms
memory: 3716kb

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: 0ms
memory: 3748kb

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: 0ms
memory: 5784kb

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: 1ms
memory: 3696kb

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 6 3000
3 1 3000

result:

ok OK: 3 operations

Test #45:

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

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 4 3000
3 1 3000

result:

ok OK: 3 operations

Test #46:

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

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: 0ms
memory: 3644kb

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: 3ms
memory: 5580kb

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: 9ms
memory: 7892kb

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: 7888kb

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: 2ms
memory: 8028kb

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: 5ms
memory: 8100kb

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: 0ms
memory: 6748kb

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

result:

ok OK: 2 operations

Test #54:

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

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: 3ms
memory: 8108kb

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: 19ms
memory: 8032kb

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: 12ms
memory: 8116kb

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: 23ms
memory: 8052kb

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: 23ms
memory: 8096kb

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

result:

ok OK: 3 operations

Test #60:

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

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