QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#822195 | #9876. Self Checkout | Misuki | AC ✓ | 35ms | 26088kb | C++20 | 9.0kb | 2024-12-19 23:40:10 | 2024-12-19 23:40:14 |
Judging History
answer
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cfenv>
#include <cfloat>
#include <chrono>
#include <cinttypes>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdarg>
#include <cstddef>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <initializer_list>
#include <iomanip>
#include <ios>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <streambuf>
#include <string>
#include <tuple>
#include <type_traits>
#include <variant>
#include <bit>
#include <compare>
#include <concepts>
#include <numbers>
#include <ranges>
#include <span>
#define int ll
#define INT128_MAX (__int128)(((unsigned __int128) 1 << ((sizeof(__int128) * __CHAR_BIT__) - 1)) - 1)
#define INT128_MIN (-INT128_MAX - 1)
#define pb push_back
#define eb emplace_back
#define clock chrono::steady_clock::now().time_since_epoch().count()
using namespace std;
template<class T1, class T2>
ostream& operator<<(ostream& os, const pair<T1, T2> pr) {
return os << pr.first << ' ' << pr.second;
}
template<class T, size_t N>
ostream& operator<<(ostream& os, const array<T, N> &arr) {
for(size_t i = 0; T x : arr) {
os << x;
if (++i != N) os << ' ';
}
return os;
}
template<class T>
ostream& operator<<(ostream& os, const vector<T> &vec) {
for(size_t i = 0; T x : vec) {
os << x;
if (++i != size(vec)) os << ' ';
}
return os;
}
template<class T>
ostream& operator<<(ostream& os, const set<T> &s) {
for(size_t i = 0; T x : s) {
os << x;
if (++i != size(s)) os << ' ';
}
return os;
}
template<class T1, class T2>
ostream& operator<<(ostream& os, const map<T1, T2> &m) {
for(size_t i = 0; pair<T1, T2> x : m) {
os << x;
if (++i != size(m)) os << ' ';
}
return os;
}
#ifdef DEBUG
#define dbg(...) cerr << '(', _do(#__VA_ARGS__), cerr << ") = ", _do2(__VA_ARGS__)
template<typename T> void _do(T &&x) { cerr << x; }
template<typename T, typename ...S> void _do(T &&x, S&&...y) { cerr << x << ", "; _do(y...); }
template<typename T> void _do2(T &&x) { cerr << x << endl; }
template<typename T, typename ...S> void _do2(T &&x, S&&...y) { cerr << x << ", "; _do2(y...); }
#else
#define dbg(...)
#endif
using ll = long long;
using ull = unsigned long long;
using ldb = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
//#define double ldb
template<typename T> using min_heap = priority_queue<T, vector<T>, greater<T>>;
template<typename T> using max_heap = priority_queue<T>;
template<ranges::forward_range rng, class T = ranges::range_value_t<rng>, class OP = plus<T>>
void pSum(rng &&v) {
if (!v.empty())
for(T p = v[0]; T &x : v | views::drop(1))
x = p = OP()(p, x);
}
template<ranges::forward_range rng, class T = ranges::range_value_t<rng>, class OP>
void pSum(rng &&v, OP op) {
if (!v.empty())
for(T p = v[0]; T &x : v | views::drop(1))
x = p = op(p, x);
}
template<ranges::forward_range rng>
void Unique(rng &v) {
ranges::sort(v);
v.resize(unique(v.begin(), v.end()) - v.begin());
}
template<ranges::random_access_range rng>
rng invPerm(rng p) {
rng ret = p;
for(int i = 0; i < ssize(p); i++)
ret[p[i]] = i;
return ret;
}
template<ranges::random_access_range rng, ranges::random_access_range rng2>
rng Permute(rng v, rng2 p) {
rng ret = v;
for(int i = 0; i < ssize(p); i++)
ret[p[i]] = v[i];
return ret;
}
template<bool directed>
vector<vector<int>> readGraph(int n, int m, int base) {
vector<vector<int>> g(n);
for(int i = 0; i < m; i++) {
int u, v; cin >> u >> v;
u -= base, v -= base;
g[u].emplace_back(v);
if constexpr (!directed)
g[v].emplace_back(u);
}
return g;
}
template<class T>
void setBit(T &msk, int bit, bool x) {
msk = (msk & ~(T(1) << bit)) | (T(x) << bit);
}
template<class T> void flipBit(T &msk, int bit) { msk ^= T(1) << bit; }
template<class T> bool getBit(T msk, int bit) { return msk >> bit & T(1); }
template<class T>
T floorDiv(T a, T b) {
if (b < 0) a *= -1, b *= -1;
return a >= 0 ? a / b : (a - b + 1) / b;
}
template<class T>
T ceilDiv(T a, T b) {
if (b < 0) a *= -1, b *= -1;
return a >= 0 ? (a + b - 1) / b : a / b;
}
template<class T> bool chmin(T &a, T b) { return a > b ? a = b, 1 : 0; }
template<class T> bool chmax(T &a, T b) { return a < b ? a = b, 1 : 0; }
//reference: https://github.com/NyaanNyaan/library/blob/master/modint/montgomery-modint.hpp#L10
//note: mod should be a prime less than 2^30.
template<uint32_t mod>
struct MontgomeryModInt {
using mint = MontgomeryModInt;
using i32 = int32_t;
using u32 = uint32_t;
using u64 = uint64_t;
static constexpr u32 get_r() {
u32 res = 1, base = mod;
for(i32 i = 0; i < 31; i++)
res *= base, base *= base;
return -res;
}
static constexpr u32 get_mod() {
return mod;
}
static constexpr u32 n2 = -u64(mod) % mod; //2^64 % mod
static constexpr u32 r = get_r(); //-P^{-1} % 2^32
u32 a;
static u32 reduce(const u64 &b) {
return (b + u64(u32(b) * r) * mod) >> 32;
}
static u32 transform(const u64 &b) {
return reduce(u64(b) * n2);
}
MontgomeryModInt() : a(0) {}
MontgomeryModInt(const int64_t &b)
: a(transform(b % mod + mod)) {}
mint pow(u64 k) const {
mint res(1), base(*this);
while(k) {
if (k & 1)
res *= base;
base *= base, k >>= 1;
}
return res;
}
mint inverse() const { return (*this).pow(mod - 2); }
u32 get() const {
u32 res = reduce(a);
return res >= mod ? res - mod : res;
}
mint& operator+=(const mint &b) {
if (i32(a += b.a - 2 * mod) < 0) a += 2 * mod;
return *this;
}
mint& operator-=(const mint &b) {
if (i32(a -= b.a) < 0) a += 2 * mod;
return *this;
}
mint& operator*=(const mint &b) {
a = reduce(u64(a) * b.a);
return *this;
}
mint& operator/=(const mint &b) {
a = reduce(u64(a) * b.inverse().a);
return *this;
}
mint operator-() { return mint() - mint(*this); }
bool operator==(mint b) const {
return (a >= mod ? a - mod : a) == (b.a >= mod ? b.a - mod : b.a);
}
bool operator!=(mint b) const {
return (a >= mod ? a - mod : a) != (b.a >= mod ? b.a - mod : b.a);
}
friend mint operator+(mint c, mint d) { return c += d; }
friend mint operator-(mint c, mint d) { return c -= d; }
friend mint operator*(mint c, mint d) { return c *= d; }
friend mint operator/(mint c, mint d) { return c /= d; }
friend ostream& operator<<(ostream& os, const mint& b) {
return os << b.get();
}
friend istream& operator>>(istream& is, mint& b) {
int64_t val;
is >> val;
b = mint(val);
return is;
}
};
using mint = MontgomeryModInt<998244353>;
//#include<modint/MontgomeryModInt.cpp>
template<class Mint>
struct binomial {
vector<Mint> _fac, _facInv;
binomial(int size) : _fac(size), _facInv(size) {
_fac[0] = 1;
for(int i = 1; i < size; i++)
_fac[i] = _fac[i - 1] * i;
if (size > 0)
_facInv.back() = 1 / _fac.back();
for(int i = size - 2; i >= 0; i--)
_facInv[i] = _facInv[i + 1] * (i + 1);
}
Mint fac(int i) { return i < 0 ? 0 : _fac[i]; }
Mint faci(int i) { return i < 0 ? 0 : _facInv[i]; }
Mint inv(int i) { return _facInv[i] * _fac[i - 1]; }
Mint binom(int n, int r) { return r < 0 or n < r ? 0 : fac(n) * faci(r) * faci(n - r); }
Mint catalan(int i) { return binom(2 * i, i) - binom(2 * i, i + 1); }
Mint excatalan(int n, int m, int k) { //(+1) * n, (-1) * m, prefix sum > -k
if (k > m) return binom(n + m, m);
else if (k > m - n) return binom(n + m, m) - binom(n + m, m - k);
else return Mint(0);
}
};
binomial<mint> bn(1 << 21);
mint f(int x) { return bn.excatalan(x, x, 2); }
mint g(int x, int y) { return y * f(x) + bn.excatalan(x + y, x, 2); }
signed main() {
ios::sync_with_stdio(false), cin.tie(NULL);
dbg(f(1));
dbg(g(1, 1));
int n; cin >> n;
string s;
for(int i = 0; i < n; i++) {
char c; cin >> c;
s += c;
}
for(int i = 0; i < n - 1; i++) {
if (s[i] == '1') {
cout << 0 << '\n';
return 0;
}
}
vector<int> l3(1), l2;
for(int i = 0, j = 0; i < n; i = j) {
while(j < n and s[i] == s[j]) j++;
if (s[i] == '2') l2.eb(j - i);
if (s[i] == '3') l3.eb(j - i);
}
mint ans = 1;
if (s.back() == '2') {
for(int i = 0; i + 1 < ssize(l3); i++)
ans *= f(l3[i]);
ans *= g(l3.back(), l2.back());
} else {
for(int i = 0; i < ssize(l3); i++)
ans *= f(l3[i]);
}
cout << ans << '\n';
dbg(l2);
dbg(l3);
return 0;
}
这程序好像有点Bug,我给组数据试试?
詳細信息
Test #1:
score: 100
Accepted
time: 14ms
memory: 19492kb
input:
2 3 2
output:
5
result:
ok "5"
Test #2:
score: 0
Accepted
time: 18ms
memory: 19360kb
input:
6 3 2 2 3 2 1
output:
4
result:
ok "4"
Test #3:
score: 0
Accepted
time: 14ms
memory: 19624kb
input:
5 3 2 1 3 2
output:
0
result:
ok "0"
Test #4:
score: 0
Accepted
time: 25ms
memory: 21540kb
input:
1000000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:
0
result:
ok "0"
Test #5:
score: 0
Accepted
time: 15ms
memory: 20580kb
input:
743956 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:
0
result:
ok "0"
Test #6:
score: 0
Accepted
time: 25ms
memory: 21520kb
input:
1000000 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 ...
output:
686017352
result:
ok "686017352"
Test #7:
score: 0
Accepted
time: 25ms
memory: 21588kb
input:
1000000 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 ...
output:
40768340
result:
ok "40768340"
Test #8:
score: 0
Accepted
time: 31ms
memory: 26080kb
input:
1000000 3 2 3 2 3 2 2 2 2 3 2 2 3 3 2 3 3 3 3 2 2 2 3 2 2 3 3 3 3 3 3 2 2 2 2 3 2 3 2 3 2 3 3 3 3 2 2 3 3 2 2 2 2 3 2 3 2 3 2 3 2 2 2 3 2 2 3 2 3 3 2 2 2 3 3 3 3 2 2 3 3 3 3 3 3 3 2 3 2 2 2 3 3 2 2 2 2 2 3 3 3 3 2 3 3 2 3 2 2 3 3 3 2 2 2 3 2 2 3 2 3 3 3 2 3 3 2 2 3 2 3 3 2 2 2 2 3 2 3 3 2 2 3 3 3 2 ...
output:
524330066
result:
ok "524330066"
Test #9:
score: 0
Accepted
time: 27ms
memory: 25884kb
input:
1000000 3 2 3 3 2 3 2 3 3 3 3 3 3 3 3 3 2 2 3 2 2 3 2 2 3 3 2 3 3 2 3 2 2 3 3 3 3 3 2 2 2 2 3 2 2 2 2 3 2 3 3 2 2 2 3 3 3 3 3 2 2 3 3 3 3 3 2 3 2 3 2 3 2 2 3 3 2 3 2 3 3 3 3 2 2 3 2 2 3 3 3 3 3 2 2 2 3 3 3 3 3 3 3 3 2 2 2 3 2 3 2 2 2 3 2 2 3 2 2 2 3 2 3 2 3 3 2 2 2 2 2 3 2 3 2 3 2 3 2 2 2 2 2 2 2 3 ...
output:
759933131
result:
ok "759933131"
Test #10:
score: 0
Accepted
time: 35ms
memory: 25856kb
input:
1000000 3 3 3 2 3 3 2 2 3 3 3 2 2 2 3 3 2 3 3 2 3 2 2 3 3 3 2 2 3 3 3 2 3 2 2 3 3 3 3 3 3 2 2 3 3 3 3 2 2 2 2 3 2 2 3 3 3 3 3 2 3 2 3 3 3 3 2 2 3 3 2 2 2 3 2 2 2 3 3 2 2 2 2 3 2 3 3 2 2 3 2 3 3 3 2 2 3 3 3 3 2 3 2 3 2 3 2 2 2 3 3 2 2 2 2 3 3 3 3 2 2 3 2 3 3 3 3 3 3 3 3 2 2 3 3 3 3 2 2 2 2 3 3 2 2 3 ...
output:
7146987
result:
ok "7146987"
Test #11:
score: 0
Accepted
time: 31ms
memory: 25888kb
input:
1000000 3 3 3 2 2 2 2 3 3 3 3 3 2 3 2 2 3 2 2 2 2 3 3 3 3 3 2 2 2 2 3 2 3 3 2 2 2 3 2 2 3 3 2 2 2 2 2 2 2 2 3 3 2 3 3 3 2 3 2 2 3 2 2 2 3 2 3 3 2 3 2 2 2 2 3 2 3 3 2 2 2 3 2 2 2 3 2 3 3 2 2 2 3 3 2 2 2 3 2 3 2 2 3 3 2 3 3 3 2 2 2 2 2 3 2 2 2 3 3 2 2 2 2 3 2 2 3 2 3 3 3 3 2 2 2 3 2 3 2 3 2 3 2 2 3 2 ...
output:
683068701
result:
ok "683068701"
Test #12:
score: 0
Accepted
time: 35ms
memory: 25840kb
input:
1000000 2 2 2 2 3 3 2 3 3 3 3 3 3 2 3 2 2 2 2 2 3 2 2 2 3 2 2 2 3 2 3 2 3 2 2 2 2 2 3 2 3 3 3 2 2 3 3 2 2 2 2 2 3 3 3 3 2 2 3 2 2 2 2 2 3 2 2 3 3 2 2 2 3 3 2 3 3 3 3 2 3 2 3 3 2 3 3 3 2 2 2 2 2 2 2 2 3 3 3 2 3 2 3 2 2 2 3 2 2 3 2 2 3 3 2 2 3 2 3 2 2 2 3 3 2 3 2 3 3 2 2 2 2 3 3 3 2 2 2 3 3 3 2 2 3 3 ...
output:
2294624
result:
ok "2294624"
Test #13:
score: 0
Accepted
time: 20ms
memory: 23972kb
input:
637586 2 2 2 2 2 2 3 2 2 2 3 3 2 2 3 3 2 2 2 3 3 3 2 3 2 2 3 3 3 2 3 3 3 3 3 2 3 2 3 3 3 2 3 2 2 3 3 2 3 2 3 2 2 2 3 3 3 2 3 3 2 3 2 2 3 2 2 2 2 3 3 2 2 3 3 3 2 2 3 2 3 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 2 3 3 2 2 2 3 3 3 2 3 2 3 3 3 2 2 2 3 2 2 3 2 3 3 3 3 2 3 2 3 2 3 2 3 3 2 2 3 2 3 2 2 3 2 2 3 3 2 3...
output:
710149533
result:
ok "710149533"
Test #14:
score: 0
Accepted
time: 21ms
memory: 24228kb
input:
731846 3 3 2 2 2 3 2 2 2 2 3 3 3 2 3 3 2 2 3 3 3 3 2 3 2 3 2 2 2 2 3 3 3 3 2 3 3 2 3 3 3 2 3 3 3 3 3 3 2 2 3 2 3 2 2 2 2 3 3 2 3 3 3 3 2 3 3 3 2 3 2 3 3 3 3 2 3 2 2 2 2 3 3 2 2 2 3 2 3 3 3 3 2 2 3 2 3 3 3 3 3 3 2 3 3 2 3 3 2 2 2 2 3 3 2 3 2 2 2 3 3 2 2 3 3 3 2 2 2 3 3 2 2 2 3 2 2 3 3 2 2 3 2 2 3 3 2...
output:
175239255
result:
ok "175239255"
Test #15:
score: 0
Accepted
time: 19ms
memory: 20816kb
input:
234456 3 2 2 3 2 2 3 3 2 2 3 2 2 3 2 3 2 3 3 2 3 2 2 3 2 2 3 2 2 3 3 2 2 2 2 3 3 2 2 3 3 2 2 2 2 3 2 3 2 3 2 2 2 2 2 3 3 2 2 3 2 3 2 2 2 2 3 2 2 3 2 3 2 3 2 3 2 3 2 2 2 3 3 3 3 2 2 2 2 2 2 3 3 2 3 3 3 3 3 2 2 3 3 3 2 2 2 3 3 3 2 2 3 3 2 2 3 3 3 2 3 3 2 2 3 2 2 2 3 2 2 3 2 3 2 2 3 2 3 3 3 3 2 3 3 2 3...
output:
178259636
result:
ok "178259636"
Test #16:
score: 0
Accepted
time: 27ms
memory: 24188kb
input:
614641 3 2 3 2 2 2 2 2 3 2 2 2 2 3 2 2 3 3 3 3 2 2 3 3 2 2 2 2 2 2 3 2 3 2 3 2 3 3 3 3 3 3 3 3 2 2 2 2 3 3 3 3 2 3 2 2 2 3 3 2 2 3 3 2 3 2 2 2 3 2 2 2 3 2 2 2 2 3 3 3 3 2 3 3 3 2 3 2 2 3 2 3 2 3 3 3 3 2 3 2 3 3 3 3 3 3 3 3 3 3 2 2 3 3 2 3 3 2 2 2 2 3 3 2 2 3 2 3 3 3 2 2 2 2 2 3 2 3 3 3 3 3 2 2 3 2 3...
output:
590475478
result:
ok "590475478"
Test #17:
score: 0
Accepted
time: 26ms
memory: 23952kb
input:
550862 3 3 3 2 2 2 2 2 3 2 3 2 3 3 3 3 2 3 2 3 2 3 3 3 2 3 3 2 3 2 3 2 3 3 3 2 3 2 3 3 3 2 2 2 3 2 3 2 2 2 2 3 2 3 3 3 2 2 3 2 3 2 2 2 3 2 3 3 3 3 3 3 2 2 2 3 3 3 2 3 3 3 2 2 3 3 3 3 2 3 3 3 2 3 2 3 3 2 2 2 3 3 2 2 2 3 2 2 3 2 3 2 3 3 2 2 3 3 3 3 3 2 2 3 2 2 3 2 2 2 3 2 3 2 3 2 3 2 2 2 2 3 2 3 3 2 3...
output:
496316643
result:
ok "496316643"
Test #18:
score: 0
Accepted
time: 20ms
memory: 21624kb
input:
1000000 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...
output:
1000001
result:
ok "1000001"
Test #19:
score: 0
Accepted
time: 16ms
memory: 19812kb
input:
108766 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...
output:
108767
result:
ok "108767"
Test #20:
score: 0
Accepted
time: 29ms
memory: 21580kb
input:
1000000 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 ...
output:
403803660
result:
ok "403803660"
Test #21:
score: 0
Accepted
time: 25ms
memory: 21544kb
input:
1000000 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 ...
output:
207755525
result:
ok "207755525"
Test #22:
score: 0
Accepted
time: 22ms
memory: 21696kb
input:
1000000 3 2 2 2 2 2 3 2 3 3 2 3 2 2 2 3 3 3 2 3 3 3 2 3 2 3 2 2 3 3 3 3 3 2 3 3 2 3 3 3 2 3 2 2 2 3 2 2 2 2 2 3 2 3 3 3 3 2 3 2 2 3 3 2 3 3 3 2 2 3 2 3 3 3 3 2 2 3 2 3 2 3 2 3 2 3 2 2 2 2 3 3 2 2 2 2 3 2 2 3 2 2 2 3 2 2 3 2 2 3 3 2 3 3 3 2 2 3 3 2 3 2 3 3 2 2 3 3 2 2 2 2 2 2 3 2 3 2 2 3 3 3 3 2 2 3 ...
output:
0
result:
ok "0"
Test #23:
score: 0
Accepted
time: 24ms
memory: 21768kb
input:
1000000 2 2 3 2 3 3 3 2 2 2 2 3 2 3 3 3 2 2 3 3 2 2 2 3 3 2 3 3 2 3 3 2 2 3 2 2 2 2 2 2 2 3 3 3 2 2 3 2 2 3 2 3 3 3 2 3 2 2 3 3 3 2 3 3 3 3 3 2 2 3 2 2 3 3 3 3 2 2 3 3 3 3 3 3 2 3 3 2 2 2 3 3 3 2 2 3 2 2 2 2 2 3 2 3 2 3 2 3 2 2 3 2 3 2 2 3 3 3 3 3 3 3 3 3 3 2 2 3 3 3 2 2 3 2 2 3 2 3 3 2 3 3 2 3 2 2 ...
output:
0
result:
ok "0"
Test #24:
score: 0
Accepted
time: 24ms
memory: 21540kb
input:
1000000 3 2 2 3 3 2 2 2 3 3 3 2 3 3 2 3 3 3 3 2 2 2 3 3 3 2 2 3 3 2 2 2 2 2 2 2 2 2 2 3 2 2 3 2 2 3 2 3 3 3 3 3 3 3 3 2 3 3 3 3 2 3 2 3 2 3 3 2 2 3 2 3 3 2 3 3 3 3 3 2 3 2 3 3 2 2 2 2 2 2 3 2 2 3 2 2 2 2 3 2 3 3 2 3 2 2 3 2 2 3 3 3 2 2 2 2 2 3 3 3 2 2 2 2 3 3 3 2 3 2 3 3 2 2 2 2 3 2 3 2 2 2 3 2 2 3 ...
output:
0
result:
ok "0"
Test #25:
score: 0
Accepted
time: 26ms
memory: 21560kb
input:
1000000 3 3 2 2 2 2 2 2 2 3 2 2 2 2 3 3 2 3 2 2 3 2 3 2 2 3 2 3 3 3 2 2 3 2 3 2 2 2 2 2 2 3 2 3 3 3 3 3 2 2 3 3 2 2 3 2 2 3 2 2 3 2 3 3 2 3 3 2 3 2 3 3 3 2 2 3 3 3 2 3 2 2 2 3 3 2 2 2 2 2 3 2 3 3 2 3 3 2 2 2 3 2 2 3 3 2 3 2 2 2 3 2 3 3 3 2 3 2 2 3 2 3 2 2 3 3 2 3 3 2 2 2 3 2 2 3 2 3 3 2 2 3 2 2 3 2 ...
output:
0
result:
ok "0"
Test #26:
score: 0
Accepted
time: 24ms
memory: 21536kb
input:
1000000 3 3 2 3 2 2 2 2 3 2 2 2 3 2 2 3 3 2 3 2 3 3 2 2 2 3 2 3 3 3 2 2 3 2 3 3 3 2 2 3 3 3 2 3 2 3 2 2 2 3 2 3 3 3 2 2 3 3 3 2 3 2 2 2 3 3 3 2 3 2 2 3 3 2 2 2 3 2 2 2 2 2 3 2 2 2 3 2 2 2 3 2 2 2 2 3 2 3 3 3 3 3 3 3 2 3 3 2 3 2 2 3 3 3 2 3 2 3 2 3 3 3 3 3 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 2 2 3 2 3 2 2 ...
output:
0
result:
ok "0"
Test #27:
score: 0
Accepted
time: 16ms
memory: 20484kb
input:
511376 3 2 2 2 2 2 3 3 2 3 2 2 2 3 2 3 3 3 2 2 3 3 3 2 2 2 2 3 3 2 2 3 2 3 3 3 3 3 2 3 2 3 2 3 2 3 2 2 3 3 3 3 3 2 3 2 3 2 3 3 3 3 3 3 3 3 3 2 2 3 2 2 3 2 3 3 2 2 2 3 2 3 2 3 2 2 2 2 2 2 3 3 2 2 3 3 3 2 2 2 3 3 3 2 2 2 2 3 2 2 2 3 3 2 2 2 3 3 2 2 3 2 2 3 3 3 3 3 3 3 3 3 2 3 2 2 3 3 2 2 2 2 2 2 3 3 3...
output:
0
result:
ok "0"
Test #28:
score: 0
Accepted
time: 15ms
memory: 19880kb
input:
104296 3 3 2 3 3 2 3 3 3 3 2 3 3 2 3 2 3 3 2 2 2 2 3 3 3 3 2 3 3 3 3 3 3 2 2 3 2 3 2 2 2 3 3 2 2 3 3 3 2 3 3 2 3 2 3 2 2 2 2 3 3 3 2 2 3 2 3 2 2 3 3 2 2 2 2 3 2 3 3 3 2 3 2 2 2 2 2 2 2 3 3 3 2 3 3 2 2 3 3 3 2 3 2 2 3 2 3 3 2 2 2 2 3 2 2 2 2 2 2 2 2 3 3 3 3 2 2 3 2 2 3 2 3 3 3 3 3 2 2 3 3 2 2 3 2 3 2...
output:
0
result:
ok "0"
Test #29:
score: 0
Accepted
time: 16ms
memory: 19880kb
input:
119245 2 2 2 3 2 2 2 3 2 2 3 2 3 3 3 2 3 2 2 2 3 2 3 2 2 3 2 2 2 2 3 3 2 3 3 3 2 3 3 2 2 3 2 3 3 3 3 2 3 3 2 2 3 3 2 2 3 3 3 3 3 2 2 2 3 2 2 2 3 3 2 3 3 2 3 3 2 2 2 2 3 2 3 2 2 2 2 3 2 2 3 2 2 2 3 3 3 3 3 3 2 3 3 2 3 2 2 3 2 3 3 3 3 3 2 3 2 3 3 3 2 2 2 3 2 2 3 2 3 2 3 2 2 2 2 3 2 3 3 2 2 3 3 3 2 2 3...
output:
0
result:
ok "0"
Test #30:
score: 0
Accepted
time: 15ms
memory: 20500kb
input:
499896 2 3 3 3 2 2 3 3 3 2 2 3 3 3 2 3 2 3 2 3 3 3 2 3 3 3 2 3 3 3 3 3 2 3 2 2 2 3 3 3 2 3 3 3 2 2 3 2 3 2 3 2 2 2 3 3 3 3 2 3 3 3 2 3 3 2 3 3 3 2 2 2 2 2 3 2 2 3 2 2 2 2 3 3 3 2 2 3 3 2 2 3 3 3 2 3 3 3 2 3 3 3 2 3 3 2 3 2 3 3 2 3 2 3 2 2 3 3 3 3 2 3 3 2 3 3 3 3 3 3 3 2 3 3 3 3 3 3 3 2 3 3 3 3 3 2 2...
output:
0
result:
ok "0"
Test #31:
score: 0
Accepted
time: 19ms
memory: 20500kb
input:
870424 3 3 3 3 3 2 3 3 2 3 2 3 2 2 3 2 3 2 2 3 3 2 3 2 3 3 2 2 3 2 3 3 3 3 3 3 3 3 3 3 3 2 2 3 3 3 3 3 2 3 2 2 2 3 2 2 3 2 2 2 3 2 2 2 2 2 3 2 2 2 2 3 3 3 3 3 3 3 2 2 2 2 3 2 2 3 3 3 2 3 2 3 3 2 2 2 2 3 3 2 3 2 3 2 3 3 3 2 3 3 3 3 2 3 3 2 3 2 2 3 2 2 2 3 3 2 3 3 2 2 2 3 2 3 2 2 2 3 2 2 2 2 3 2 3 2 3...
output:
0
result:
ok "0"
Test #32:
score: 0
Accepted
time: 25ms
memory: 21616kb
input:
1000000 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 ...
output:
686017352
result:
ok "686017352"
Test #33:
score: 0
Accepted
time: 19ms
memory: 19880kb
input:
100432 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3...
output:
848135413
result:
ok "848135413"
Test #34:
score: 0
Accepted
time: 25ms
memory: 21700kb
input:
1000000 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 ...
output:
481078003
result:
ok "481078003"
Test #35:
score: 0
Accepted
time: 25ms
memory: 21528kb
input:
1000000 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 ...
output:
429280846
result:
ok "429280846"
Test #36:
score: 0
Accepted
time: 29ms
memory: 21584kb
input:
1000000 2 2 3 2 3 3 2 2 1 3 2 2 3 2 1 3 2 1 2 1 3 1 1 2 1 3 3 1 2 2 1 2 2 1 2 2 2 2 1 3 3 1 2 3 2 1 2 1 3 1 2 2 2 2 2 3 1 2 2 3 2 2 1 3 3 2 3 2 3 2 1 1 2 3 1 1 3 2 3 1 1 2 1 2 1 2 2 3 2 3 1 2 1 3 2 3 1 1 2 3 1 2 3 1 3 2 2 2 3 1 2 2 2 3 2 3 1 3 3 2 2 2 2 3 3 3 2 2 1 3 1 3 1 1 3 2 1 3 2 1 1 3 1 2 1 1 ...
output:
0
result:
ok "0"
Test #37:
score: 0
Accepted
time: 24ms
memory: 21564kb
input:
1000000 2 3 2 1 2 2 1 1 2 3 3 2 2 3 1 3 3 3 2 2 3 1 3 3 2 1 1 1 1 3 2 1 2 2 2 3 1 3 2 2 2 3 2 2 2 2 1 2 2 1 1 1 1 1 1 1 1 3 1 1 3 1 2 2 1 1 2 1 1 3 3 2 3 3 2 2 2 2 3 1 2 1 1 2 1 1 3 3 3 2 2 1 3 3 1 3 2 2 2 2 3 3 3 1 2 3 2 2 1 1 2 2 2 3 2 3 1 3 2 3 2 1 2 1 1 3 3 1 2 1 2 1 2 2 2 3 2 3 3 2 1 2 1 2 1 2 ...
output:
0
result:
ok "0"
Test #38:
score: 0
Accepted
time: 28ms
memory: 21760kb
input:
1000000 3 1 3 1 1 1 1 2 2 2 1 3 3 2 2 3 2 3 3 2 3 3 3 2 2 1 3 3 3 3 3 2 3 2 3 1 1 1 2 2 1 1 3 2 3 1 3 3 1 2 3 3 2 2 1 3 1 1 1 2 3 2 1 1 3 2 2 3 3 3 2 3 1 3 3 2 3 2 1 1 2 2 3 1 1 2 3 2 2 3 1 3 2 3 2 2 2 1 3 3 1 2 3 1 3 3 1 2 2 2 1 3 2 3 3 2 2 3 1 3 3 3 3 3 3 1 1 2 1 1 3 2 1 1 1 1 1 3 2 3 1 3 3 3 3 2 ...
output:
0
result:
ok "0"
Test #39:
score: 0
Accepted
time: 24ms
memory: 21612kb
input:
1000000 2 2 2 2 3 2 1 2 2 1 1 2 3 1 1 1 2 2 3 3 2 1 3 3 2 1 3 3 1 2 2 2 2 1 1 2 2 1 3 1 3 1 3 3 1 2 3 2 2 3 1 2 3 2 3 3 3 1 3 2 1 2 2 3 2 1 3 3 3 3 1 1 2 2 3 1 3 1 2 1 2 3 3 3 2 3 1 2 2 2 2 2 3 3 2 2 3 2 1 1 2 3 1 1 2 1 2 1 3 2 3 2 2 2 2 1 1 3 1 2 1 3 2 1 2 1 2 3 3 1 2 2 3 1 3 3 3 2 1 1 2 3 1 3 1 2 ...
output:
0
result:
ok "0"
Test #40:
score: 0
Accepted
time: 24ms
memory: 21524kb
input:
1000000 2 1 2 1 3 3 2 2 1 1 1 3 2 3 3 2 2 2 1 3 2 1 3 2 2 2 3 3 1 1 2 2 2 2 3 2 2 1 1 2 2 2 1 2 2 1 1 2 2 2 2 2 2 3 2 1 1 1 1 1 1 3 1 2 1 3 3 3 2 3 1 3 2 3 2 1 1 2 3 3 3 3 2 1 2 3 2 2 1 1 1 3 2 1 1 1 2 1 1 1 2 1 2 2 3 2 1 3 2 3 1 1 2 1 2 3 1 3 1 3 3 1 2 2 3 1 1 2 3 1 1 1 3 2 2 3 3 3 2 2 2 2 2 3 1 2 ...
output:
0
result:
ok "0"
Test #41:
score: 0
Accepted
time: 27ms
memory: 20516kb
input:
897920 2 2 1 1 3 1 1 2 1 2 2 2 2 3 2 1 3 3 3 3 1 1 3 3 3 3 3 1 2 1 2 1 2 3 1 2 2 2 3 2 2 1 2 2 1 2 2 1 2 1 3 1 3 3 1 1 3 2 3 3 3 3 1 3 1 1 2 2 1 1 2 1 3 3 2 3 3 1 3 2 3 1 2 2 2 3 1 2 2 1 3 2 3 3 3 1 2 1 1 1 3 1 2 3 3 1 1 2 1 2 2 2 2 2 1 1 3 3 3 3 2 1 1 3 1 1 2 1 1 1 1 3 3 3 3 3 2 1 1 1 3 1 1 3 2 1 1...
output:
0
result:
ok "0"
Test #42:
score: 0
Accepted
time: 20ms
memory: 20664kb
input:
685690 1 2 3 2 3 3 2 1 3 2 3 3 3 2 1 2 1 3 2 3 2 1 2 3 3 2 2 2 1 1 1 1 2 1 3 1 1 3 1 1 3 3 1 1 2 1 2 3 1 3 2 2 2 1 1 3 2 1 2 2 3 2 3 3 3 2 3 3 2 2 2 3 2 1 3 1 2 1 1 1 3 2 3 1 3 2 1 3 2 1 1 2 3 2 2 1 2 3 2 1 2 3 2 3 3 3 2 1 2 3 2 3 2 1 2 3 1 1 1 2 1 3 3 2 1 3 3 2 2 3 3 1 3 2 2 1 3 1 2 3 2 3 1 1 2 2 2...
output:
0
result:
ok "0"
Test #43:
score: 0
Accepted
time: 17ms
memory: 20608kb
input:
664461 3 3 3 3 1 2 1 1 3 1 3 3 1 2 2 3 3 3 2 3 1 2 1 3 1 1 3 1 1 2 1 1 1 1 3 1 1 3 3 1 3 2 3 3 3 2 2 2 1 3 1 1 2 1 1 3 1 3 2 2 3 3 3 1 2 3 3 3 3 2 2 1 3 1 2 1 3 1 2 3 1 3 1 3 1 1 1 3 3 2 1 3 2 2 1 2 3 1 2 1 2 1 1 2 2 2 1 1 1 1 1 1 2 1 3 1 1 2 1 1 1 2 3 3 2 3 2 2 1 1 1 2 1 1 3 1 2 2 2 1 1 3 3 3 1 1 3...
output:
0
result:
ok "0"
Test #44:
score: 0
Accepted
time: 22ms
memory: 20504kb
input:
900750 2 3 2 3 1 1 1 2 1 3 2 2 1 1 1 3 2 2 2 3 1 3 1 1 3 2 3 2 2 3 3 1 2 2 2 2 2 3 1 2 1 1 2 2 1 2 1 2 1 3 2 3 2 3 1 1 3 3 1 2 3 3 1 1 3 3 1 2 2 2 2 3 1 1 3 1 3 2 2 1 2 1 3 1 2 3 1 3 1 1 1 3 2 2 1 3 3 1 3 3 3 1 3 3 3 2 2 3 2 3 3 1 3 2 3 1 2 3 2 3 2 2 1 1 3 3 2 3 2 1 1 2 1 1 1 1 2 1 1 2 3 2 3 2 3 2 3...
output:
0
result:
ok "0"
Test #45:
score: 0
Accepted
time: 16ms
memory: 19948kb
input:
190397 3 1 3 2 3 2 1 1 1 3 2 2 1 1 2 3 1 2 1 1 2 2 1 2 2 3 3 2 2 3 1 2 3 1 1 3 1 3 3 1 1 3 1 2 2 1 1 3 3 2 1 3 1 3 3 3 2 1 2 3 2 3 2 2 1 3 3 3 1 2 2 3 1 3 2 2 3 1 2 2 2 1 2 2 2 3 1 2 1 1 2 3 1 1 3 1 2 1 3 3 1 3 1 1 1 2 1 3 3 3 2 2 2 3 2 3 1 1 3 3 3 2 3 3 2 2 2 3 2 1 2 3 2 3 3 2 3 3 1 2 3 1 2 1 3 2 2...
output:
0
result:
ok "0"
Test #46:
score: 0
Accepted
time: 22ms
memory: 21692kb
input:
1000000 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 ...
output:
831727446
result:
ok "831727446"
Test #47:
score: 0
Accepted
time: 20ms
memory: 21692kb
input:
1000000 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 ...
output:
122657581
result:
ok "122657581"
Test #48:
score: 0
Accepted
time: 24ms
memory: 21696kb
input:
1000000 1 2 2 1 1 1 2 1 3 2 1 3 1 3 2 3 1 1 1 2 2 2 3 2 1 3 1 2 2 3 2 3 1 2 2 1 1 3 3 3 2 3 1 2 1 1 2 1 3 3 3 1 2 3 3 3 1 1 2 1 3 1 2 1 1 1 1 2 2 1 3 3 1 2 1 1 3 3 3 2 3 3 1 2 2 2 1 3 2 3 3 2 2 1 1 2 3 2 1 1 3 2 2 3 1 1 3 1 2 1 1 2 2 2 1 2 2 3 3 2 2 2 2 1 3 1 3 3 2 1 3 1 3 3 2 1 3 2 2 3 2 1 1 2 3 3 ...
output:
0
result:
ok "0"
Test #49:
score: 0
Accepted
time: 25ms
memory: 21584kb
input:
1000000 2 2 3 2 2 2 1 2 1 2 1 2 3 1 3 1 3 2 1 3 3 3 3 1 1 1 2 1 3 3 3 2 2 2 1 1 3 3 1 2 2 1 3 3 1 2 3 2 3 1 3 2 3 2 2 3 2 1 3 3 1 3 3 3 3 1 1 1 3 2 3 2 2 2 1 3 1 2 3 2 3 2 1 1 2 2 3 2 1 3 3 2 2 2 3 2 1 1 1 3 2 2 1 3 3 3 3 3 1 3 2 2 1 1 3 3 2 1 2 2 2 1 2 2 2 3 3 3 3 1 1 1 3 2 1 2 2 1 2 2 3 2 3 1 2 1 ...
output:
0
result:
ok "0"
Test #50:
score: 0
Accepted
time: 14ms
memory: 19308kb
input:
8 2 2 1 1 2 1 2 2
output:
0
result:
ok "0"
Test #51:
score: 0
Accepted
time: 14ms
memory: 19524kb
input:
4 1 2 1 2
output:
0
result:
ok "0"
Test #52:
score: 0
Accepted
time: 25ms
memory: 21596kb
input:
1000000 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...
output:
2999999
result:
ok "2999999"
Test #53:
score: 0
Accepted
time: 25ms
memory: 21744kb
input:
1000000 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...
output:
2
result:
ok "2"
Test #54:
score: 0
Accepted
time: 31ms
memory: 26064kb
input:
1000000 2 3 3 2 3 2 3 3 2 3 2 2 3 3 3 2 3 2 2 3 3 2 2 3 3 2 3 3 2 2 2 3 2 3 2 3 3 3 2 2 2 3 2 2 2 2 3 2 3 2 3 2 2 2 3 3 3 3 3 2 3 3 3 2 2 2 3 3 3 2 3 2 3 3 3 3 3 3 2 2 2 2 3 3 3 2 3 2 3 3 2 2 3 2 2 3 2 2 3 3 2 2 2 2 2 3 3 2 3 2 3 3 2 3 3 3 2 2 2 2 3 2 2 2 3 3 2 2 2 2 2 3 3 3 3 3 3 3 3 2 2 3 2 3 2 3 ...
output:
820447236
result:
ok "820447236"
Test #55:
score: 0
Accepted
time: 27ms
memory: 25884kb
input:
1000000 2 2 3 3 3 3 3 3 3 3 2 2 3 3 2 2 2 3 3 3 2 2 3 2 2 3 3 3 3 3 3 2 2 3 3 3 3 3 3 3 3 3 3 2 3 3 2 2 2 3 2 3 2 2 2 3 3 3 2 3 3 3 2 2 2 3 3 2 2 2 2 2 2 3 3 2 3 2 3 2 3 3 2 3 3 3 2 3 2 3 2 2 3 2 2 3 3 2 3 2 2 3 3 2 2 2 2 3 3 3 2 3 2 3 3 3 2 3 3 3 3 3 2 3 3 2 3 2 3 3 3 3 3 3 3 3 3 2 2 2 3 2 2 3 3 3 ...
output:
748187707
result:
ok "748187707"
Test #56:
score: 0
Accepted
time: 31ms
memory: 26088kb
input:
1000000 3 2 2 2 2 2 3 2 2 2 3 3 3 3 3 2 2 2 3 3 2 3 2 3 2 3 2 2 3 3 2 2 3 2 3 2 2 2 2 2 2 2 2 2 2 2 3 3 2 2 2 2 3 2 2 2 2 2 3 2 2 3 2 2 3 3 3 2 2 3 2 2 2 2 2 2 3 2 3 3 3 3 2 3 2 2 3 2 3 2 3 3 2 2 3 2 3 2 3 2 2 2 3 3 2 3 2 2 2 2 2 2 2 2 2 3 3 3 2 2 3 3 2 3 3 2 2 2 2 2 2 2 2 3 3 3 2 2 2 3 3 3 2 2 3 2 ...
output:
232126478
result:
ok "232126478"
Test #57:
score: 0
Accepted
time: 27ms
memory: 26016kb
input:
1000000 2 3 2 2 3 2 3 3 2 2 3 2 2 2 2 3 3 2 2 3 2 3 2 3 2 3 2 3 3 3 3 2 3 3 2 2 3 2 2 2 2 3 3 3 2 3 3 2 2 2 2 2 2 3 3 3 3 2 3 2 3 2 3 2 2 2 2 3 3 2 2 3 3 3 3 2 3 2 3 2 3 2 3 3 3 2 3 3 2 3 2 2 3 3 3 2 2 2 2 3 3 2 2 2 2 2 2 2 3 2 3 3 3 2 2 3 3 3 3 3 2 2 2 2 3 2 2 3 2 3 3 2 2 2 3 3 3 2 3 3 2 3 2 2 2 3 ...
output:
766356020
result:
ok "766356020"
Test #58:
score: 0
Accepted
time: 31ms
memory: 25848kb
input:
1000000 2 3 3 2 2 2 2 2 2 2 3 2 2 3 3 2 2 3 2 3 2 2 3 2 3 2 2 3 2 3 2 2 2 2 2 2 2 2 2 3 3 2 3 3 2 3 3 2 2 3 2 2 3 2 3 3 2 2 2 2 2 3 3 3 3 2 3 3 3 3 2 3 2 2 3 3 3 2 2 2 2 2 3 3 2 2 2 2 2 3 2 3 2 3 2 3 3 2 2 3 2 3 2 2 2 2 3 3 2 3 3 2 2 2 2 2 3 3 3 2 2 2 2 2 2 2 2 3 3 3 2 3 2 3 3 3 2 3 3 2 3 3 3 2 3 2 ...
output:
667015541
result:
ok "667015541"
Test #59:
score: 0
Accepted
time: 20ms
memory: 21572kb
input:
287217 3 3 3 2 2 2 2 3 2 2 2 2 3 2 2 3 3 3 3 3 3 3 2 2 2 2 3 2 2 3 3 2 2 2 3 3 3 2 2 3 2 2 3 2 3 3 2 2 2 3 3 2 2 2 3 2 3 3 2 2 2 2 2 2 3 3 2 2 2 2 3 3 3 3 2 3 3 2 2 2 2 2 3 2 3 2 2 2 2 3 3 2 2 3 3 3 2 3 3 3 2 2 3 3 3 3 2 3 2 2 3 3 2 3 2 2 2 3 3 2 2 2 2 3 2 3 2 3 2 3 3 3 2 2 3 3 3 3 2 2 2 2 3 3 2 3 2...
output:
331407254
result:
ok "331407254"
Test #60:
score: 0
Accepted
time: 17ms
memory: 20860kb
input:
155307 3 2 2 2 3 3 3 2 2 3 3 2 2 3 3 3 3 3 3 2 2 3 3 2 2 3 2 2 3 2 3 2 2 3 2 3 3 3 2 2 3 3 2 3 2 2 3 3 2 2 2 3 2 3 2 2 2 3 2 2 2 2 2 2 2 2 3 2 2 2 2 2 2 2 2 3 2 2 2 3 3 2 3 3 2 2 3 3 3 2 3 2 2 2 2 3 2 2 3 3 2 3 3 3 2 3 2 3 2 3 3 3 3 2 2 2 3 2 3 2 2 2 3 3 3 3 3 2 3 3 2 2 3 3 2 3 3 2 3 3 2 2 3 3 3 2 2...
output:
869312595
result:
ok "869312595"
Test #61:
score: 0
Accepted
time: 18ms
memory: 20876kb
input:
167271 2 3 3 3 3 3 3 2 3 3 3 3 2 3 2 2 3 3 2 3 2 2 3 2 3 3 2 3 2 3 3 3 3 3 2 2 3 3 2 3 2 2 3 2 2 2 2 2 2 2 3 2 2 2 2 3 3 2 2 3 2 2 3 2 3 3 3 3 3 2 2 2 2 2 2 3 2 3 3 3 2 2 3 2 3 2 3 3 3 3 3 3 3 2 3 2 3 3 2 2 2 2 2 2 2 3 2 3 2 2 3 2 3 3 2 2 2 3 3 3 2 3 3 2 2 3 3 3 3 3 3 2 2 2 3 2 2 3 2 3 2 2 3 3 2 2 3...
output:
922488383
result:
ok "922488383"
Test #62:
score: 0
Accepted
time: 25ms
memory: 21700kb
input:
1000000 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...
output:
513338050
result:
ok "513338050"
Test #63:
score: 0
Accepted
time: 25ms
memory: 21744kb
input:
1000000 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...
output:
182405174
result:
ok "182405174"
Test #64:
score: 0
Accepted
time: 11ms
memory: 19360kb
input:
3 1 2 3
output:
0
result:
ok "0"
Test #65:
score: 0
Accepted
time: 15ms
memory: 19328kb
input:
3 1 3 2
output:
0
result:
ok "0"
Test #66:
score: 0
Accepted
time: 15ms
memory: 19536kb
input:
3 2 1 3
output:
0
result:
ok "0"
Test #67:
score: 0
Accepted
time: 15ms
memory: 19456kb
input:
3 2 3 1
output:
2
result:
ok "2"
Test #68:
score: 0
Accepted
time: 18ms
memory: 19468kb
input:
3 3 1 2
output:
0
result:
ok "0"
Test #69:
score: 0
Accepted
time: 14ms
memory: 19436kb
input:
3 3 2 1
output:
2
result:
ok "2"
Extra Test:
score: 0
Extra Test Passed