QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#296618 | #7935. Distinct Game | ucup-team087# | AC ✓ | 127ms | 20616kb | C++14 | 11.8kb | 2024-01-03 11:14:39 | 2024-01-03 11:14:39 |
Judging History
answer
#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
using Int = long long;
template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { return os << "(" << a.first << ", " << a.second << ")"; };
template <class T> ostream &operator<<(ostream &os, const vector<T> &as) { const int sz = as.size(); os << "["; for (int i = 0; i < sz; ++i) { if (i >= 256) { os << ", ..."; break; } if (i > 0) { os << ", "; } os << as[i]; } return os << "]"; }
template <class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << " "; cerr << endl; }
template <class T> bool chmin(T &t, const T &f) { if (t > f) { t = f; return true; } return false; }
template <class T> bool chmax(T &t, const T &f) { if (t < f) { t = f; return true; } return false; }
#define COLOR(s) ("\x1b[" s "m")
////////////////////////////////////////////////////////////////////////////////
// 2^61 - 1 = 2'305'843'009'213'693'951
struct ModLong61 {
static constexpr unsigned long long M = (1ULL << 61) - 1;
unsigned long long x;
constexpr ModLong61() : x(0ULL) {}
constexpr ModLong61(unsigned x_) : x(x_) {}
constexpr ModLong61(unsigned long long x_) : x(x_ % M) {}
constexpr ModLong61(int x_) : x((x_ < 0) ? (x_ + static_cast<long long>(M)) : x_) {}
constexpr ModLong61(long long x_) : x(((x_ %= static_cast<long long>(M)) < 0) ? (x_ + static_cast<long long>(M)) : x_) {}
ModLong61 &operator+=(const ModLong61 &a) { x = ((x += a.x) >= M) ? (x - M) : x; return *this; }
ModLong61 &operator-=(const ModLong61 &a) { x = ((x -= a.x) >= M) ? (x + M) : x; return *this; }
ModLong61 &operator*=(const ModLong61 &a) {
const unsigned __int128 y = static_cast<unsigned __int128>(x) * a.x;
x = (y >> 61) + (y & M);
x = (x >= M) ? (x - M) : x;
return *this;
}
ModLong61 &operator/=(const ModLong61 &a) { return (*this *= a.inv()); }
ModLong61 pow(long long e) const {
if (e < 0) return inv().pow(-e);
ModLong61 a = *this, b = 1ULL; for (; e; e >>= 1) { if (e & 1) b *= a; a *= a; } return b;
}
ModLong61 inv() const {
unsigned long long a = M, b = x; long long y = 0, z = 1;
for (; b; ) { const unsigned long long q = a / b; const unsigned long long c = a - q * b; a = b; b = c; const long long w = y - static_cast<long long>(q) * z; y = z; z = w; }
assert(a == 1ULL); return ModLong61(y);
}
ModLong61 operator+() const { return *this; }
ModLong61 operator-() const { ModLong61 a; a.x = x ? (M - x) : 0ULL; return a; }
ModLong61 operator+(const ModLong61 &a) const { return (ModLong61(*this) += a); }
ModLong61 operator-(const ModLong61 &a) const { return (ModLong61(*this) -= a); }
ModLong61 operator*(const ModLong61 &a) const { return (ModLong61(*this) *= a); }
ModLong61 operator/(const ModLong61 &a) const { return (ModLong61(*this) /= a); }
template <class T> friend ModLong61 operator+(T a, const ModLong61 &b) { return (ModLong61(a) += b); }
template <class T> friend ModLong61 operator-(T a, const ModLong61 &b) { return (ModLong61(a) -= b); }
template <class T> friend ModLong61 operator*(T a, const ModLong61 &b) { return (ModLong61(a) *= b); }
template <class T> friend ModLong61 operator/(T a, const ModLong61 &b) { return (ModLong61(a) /= b); }
explicit operator bool() const { return x; }
bool operator==(const ModLong61 &a) const { return (x == a.x); }
bool operator!=(const ModLong61 &a) const { return (x != a.x); }
friend std::ostream &operator<<(std::ostream &os, const ModLong61 &a) { return os << a.x; }
};
////////////////////////////////////////////////////////////////////////////////
#include <chrono>
#ifdef LOCAL
mt19937_64 rng(58);
#else
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
#endif
// [l, r]
Int randLong(Int l, Int r) {
return uniform_int_distribution<Int>(l, r)(rng);
}
// const ModLong61 BASE = randLong(0, ModLong61::M - 1);
////////////////////////////////////////////////////////////////////////////////
bool solve(const vector<vector<int>> &stacks) {
int lens[2];
for (int i = 0; i < 2; ++i) {
lens[i] = stacks[i].size();
}
const int N = (lens[0] + lens[1]) / 2;
vector<ModLong61> rnds(N);
for (int u = 0; u < N; ++u) {
rnds[u] = randLong(0, ModLong61::M - 1);
}
vector<pair<unsigned long long, int>> h1s;
{
ModLong61 h;
for (int j = 0; ; j += 2) {
h1s.emplace_back((-h).x, -j);
if (j + 2 <= lens[1]) {
h += rnds[stacks[1][j]];
h -= rnds[stacks[1][j + 1]];
} else {
break;
}
}
}
sort(h1s.begin(), h1s.end());
int ls[2] = {};
{
ModLong61 h;
for (int j = 0; ; j += 2) {
auto it = lower_bound(h1s.begin(), h1s.end(), make_pair(h.x, -lens[1]));
if (it != h1s.end() && it->first == h.x) {
chmax(ls[0], j);
chmax(ls[1], -it->second);
}
if (j + 2 <= lens[0]) {
h += rnds[stacks[0][j]];
h -= rnds[stacks[0][j + 1]];
} else {
break;
}
}
}
int rs[2] = {lens[0], lens[1]};
for (; ls[0] < rs[0] && ls[1] < rs[1] && stacks[0][rs[0] - 1] == stacks[1][rs[1] - 1]; ) {
--rs[0];
--rs[1];
}
vector<vector<int>> rems(2);
for (int i = 0; i < 2; ++i) {
for (int j = ls[i]; j < rs[i]; ) {
if ((j - ls[i]) % 2 != 0 && j + 1 < rs[i] && stacks[i][j] == stacks[i][j + 1]) {
j += 2;
} else {
rems[i].push_back(stacks[i][j]);
j += 1;
}
}
}
reverse(rems[1].begin(), rems[1].end());
return (rems[0] != rems[1]);
}
map<pair<vector<vector<int>>, int>, bool> cache;
bool brute(const vector<vector<int>> &stacks, int taken) {
const auto key = make_pair(stacks, taken);
auto it = cache.find(key);
if (it != cache.end()) return it->second;
int sz = 0;
for (int i = 0; i < (int)stacks.size(); ++i) sz += (int)stacks[i].size();
for (int i = 0; i < (int)stacks.size(); ++i) if (stacks[i].size()) {
if (sz % 2 == 0 && (taken & 1 << stacks[i].back())) return cache[key] = true;
auto s = stacks;
s[i].pop_back();
if (!brute(s, (sz % 2 == 0) ? (taken | 1 << stacks[i].back()) : taken)) return cache[key] = true;
}
return cache[key] = false;
}
void expr() {
for (int n = 1; n <= 6; ++n) {
for (int k = 0; k <= 2 * n; ++k) {
vector<int> perm(2 * n);
for (int i = 0; i < 2 * n; ++i) perm[i] = i / 2;
do {
{
bool ok = true;
int mx = -1;
for (int j = 0; j < 2 * n; ++j) {
ok = ok && (mx + 1 >= perm[j]);
chmax(mx, perm[j]);
}
if (!ok) {
continue;
}
}
const vector<vector<int>> stacks{
vector<int>(perm.begin(), perm.begin() + k),
vector<int>(perm.begin() + k, perm.end()),
};
const int lens[2] = {k, 2 * n - k};
const bool brt = brute(stacks, 0);
const bool slv = solve(stacks);
if (brt != slv) {
cerr << "FAIL " << stacks << ": " << brt << " " << slv << endl;
}
assert(brt == slv);
// torikaesanaito owari
if (lens[0] && lens[1] && stacks[0].back() == stacks[1].back()) {
auto s = stacks;
s[0].pop_back();
s[1].pop_back();
assert(brt == brute(s, 0));
continue;
}
int ma[2] = {0, 0};
{
vector<pair<int, int>> m0m1s;
for (int m0 = 0; m0 <= lens[0]; m0 += 2) for (int m1 = 0; m1 <= lens[1]; ++m1) {
int ps[2] = {};
for (int j = 0; j < m0; ++j) ps[j & 1] |= 1 << stacks[0][j];
for (int j = 0; j < m1; ++j) ps[j & 1] |= 1 << stacks[1][j];
if (ps[0] == ps[1]) {
m0m1s.emplace_back(m0, m1);
}
}
for (const auto &m0m1 : m0m1s) {
if (make_pair(ma[0], ma[1]) < m0m1) {
ma[0] = m0m1.first;
ma[1] = m0m1.second;
}
}
for (const auto &m0m1 : m0m1s) {
assert(ma[0] >= m0m1.first);
assert(ma[1] >= m0m1.second);
}
}
// matching
if (ma[0] == lens[0] && ma[1] == lens[1]) {
assert(!brt);
continue;
}
// reverse sugoi -> matching
// assert OK but skip this check
/*
if (lens[0] - ma[0] == lens[1] - ma[1]) {
const int r = lens[0] - ma[0];
bool rev = true;
for (int j = 0; j < r; ++j) {
rev = rev && (stacks[0][lens[0] - 1 - j] == stacks[1][lens[1] - r + j]);
}
if (rev) {
assert(r % 2 != 0);
assert(!brt);
continue;
}
}
*/
if (ma[0] || ma[1]) {
const vector<vector<int>> s{
vector<int>(stacks[0].begin() + ma[0], stacks[0].end()),
vector<int>(stacks[1].begin() + ma[1], stacks[1].end()),
};
assert(brt == brute(s, 0));
continue;
}
// assert OK but skip this check
/*
vector<vector<int>> reduced(2);
for (int i = 0; i < 2; ++i) {
for (int j = 0; j < lens[i]; ++j) {
if (reduced[i].size() && reduced[i].back() == stacks[i][j]) {
reduced[i].pop_back();
} else {
reduced[i].push_back(stacks[i][j]);
}
}
}
const int red = brute(reduced, 0);
if (stacks == reduced) {
if (!brt) {
cerr << stacks << ": " << brt << endl;
}
assert(brt);
continue;
}
// sente can reduce
if (red) {
assert(brt);
continue;
}
*/
/*
if (!brt) {
// cout << stacks << ": " << brt << endl;
for (int i = 0; i < 2; ++i) {
for (int j = 0; j < lens[i]; ++j) {
cout << stacks[i][j];
}
cout << '\n';
}
cout << endl;
}
*/
{
vector<vector<int>> rems(2);
for (int i = 0; i < 2; ++i) {
for (int j = 0; j < lens[i]; ) {
if (j % 2 != 0 && j + 1 < lens[i] && stacks[i][j] == stacks[i][j + 1]) {
j += 2;
} else {
rems[i].push_back(stacks[i][j]);
j += 1;
}
}
}
reverse(rems[1].begin(), rems[1].end());
if (rems[0] == rems[1]) {
assert(!brt);
continue;
}
}
assert(brt);
} while (next_permutation(perm.begin(), perm.end()));
}
cerr << "DONE n = " << n << ": |cache| = " << cache.size() << endl;
}
}
int main() {
// expr();
for (int numCases; ~scanf("%d", &numCases); ) { for (int caseId = 1; caseId <= numCases; ++caseId) {
int lens[2];
scanf("%d%d", &lens[0], &lens[1]);
vector<vector<int>> stacks(2);
for (int i = 0; i < 2; ++i) {
stacks[i].resize(lens[i]);
for (int j = 0; j < lens[i]; ++j) {
scanf("%d", &stacks[i][j]);
--stacks[i][j];
}
}
const bool ans = solve(stacks);
puts(ans ? "1" : "2");
}
#ifndef LOCAL
break;
#endif
}
return 0;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3636kb
input:
4 1 3 1 1 2 2 3 3 1 2 3 2 3 1 2 4 3 1 2 3 1 2 2 2 1 2 1 2
output:
2 1 2 2
result:
ok 4 number(s): "2 1 2 2"
Test #2:
score: 0
Accepted
time: 114ms
memory: 16380kb
input:
1 450001 450001 143562 41175 381473 209641 84140 134637 447958 150340 146958 324320 112343 154316 163347 187380 233550 74824 438853 143882 86926 318212 356926 144063 441521 165444 291785 104472 361893 69986 247461 46614 218237 101640 303246 359741 78564 202387 91536 96471 76916 28359 37386 340728 26...
output:
2
result:
ok 1 number(s): "2"
Test #3:
score: 0
Accepted
time: 54ms
memory: 9748kb
input:
1 250289 250289 214539 81482 122517 246870 81227 138177 50930 202191 57290 64143 192 48958 113936 81686 20229 44855 83378 69120 6347 187024 44310 228045 59714 239073 98250 63666 157733 24276 145542 240413 26762 154770 65273 3688 96105 198736 71371 83294 84454 243261 176118 99847 49881 61848 124879 7...
output:
2
result:
ok 1 number(s): "2"
Test #4:
score: 0
Accepted
time: 64ms
memory: 9864kb
input:
1 250283 250283 131901 162113 43990 5106 7768 168708 186002 243830 127381 199941 49613 223447 54701 206963 100758 57219 85552 182138 90981 153558 148819 199177 155895 247969 111381 220978 70081 220626 149030 678 91298 104178 17597 34385 82610 17228 104040 44596 7561 237395 138765 83478 120030 11197 ...
output:
2
result:
ok 1 number(s): "2"
Test #5:
score: 0
Accepted
time: 80ms
memory: 12908kb
input:
1 350029 350029 168022 144691 110996 347771 335886 46208 213285 170625 187356 223269 274419 52008 45890 76190 102211 44961 163401 316554 190757 285570 26108 167341 102274 88040 34883 131199 331495 281648 287915 243416 101673 88110 6275 161796 295817 228221 347627 49467 289406 257256 152026 209705 23...
output:
2
result:
ok 1 number(s): "2"
Test #6:
score: 0
Accepted
time: 121ms
memory: 16164kb
input:
1 496875 496875 125733 303559 142443 83983 27601 465961 270820 459882 102907 358587 343116 343758 286897 136806 82480 58736 16789 135226 299009 68981 68981 433868 455831 417898 331734 432418 172206 136605 345229 233614 365009 218820 298872 75077 307359 309900 309900 483370 176582 343808 434092 44947...
output:
2
result:
ok 1 number(s): "2"
Test #7:
score: 0
Accepted
time: 105ms
memory: 14108kb
input:
1 430008 430008 154735 355476 186842 104739 126202 428381 174968 360695 6447 425048 68007 216862 78972 313846 151316 211059 119321 67229 100326 389594 239202 226921 59715 133315 90512 120103 237417 185531 259969 283656 223527 220173 69396 235349 56065 427882 83189 170533 208068 131765 313063 274562 ...
output:
2
result:
ok 1 number(s): "2"
Test #8:
score: 0
Accepted
time: 109ms
memory: 14704kb
input:
1 430253 430253 110424 48460 294555 98145 99445 391062 210392 24970 377361 298970 337386 366734 41810 298120 45926 803 170897 137996 397900 34088 364108 56501 116319 365287 143647 184394 275192 142826 140694 226287 325358 210076 348965 326879 428296 359736 290678 380872 167510 294940 53897 77992 768...
output:
1
result:
ok 1 number(s): "1"
Test #9:
score: 0
Accepted
time: 98ms
memory: 14652kb
input:
1 430271 430271 175612 349187 421996 202968 36043 191676 141456 183988 92645 345281 16163 51977 147220 231550 112964 338526 127966 208465 111702 115589 278844 226876 191824 393677 349408 61279 186354 217659 31019 89504 172186 47180 246151 100962 177890 397890 306574 349682 321517 198414 394953 30085...
output:
1
result:
ok 1 number(s): "1"
Test #10:
score: 0
Accepted
time: 97ms
memory: 14660kb
input:
1 430143 430143 44952 286868 226089 152506 345219 182727 126683 203380 54791 146833 133965 178219 118055 14082 144949 201372 284822 2482 234683 20922 160413 48017 55129 181778 44631 21031 419329 326174 133641 138293 243825 210494 319717 24304 335570 399881 13686 395768 18657 240417 107862 6380 99489...
output:
1
result:
ok 1 number(s): "1"
Test #11:
score: 0
Accepted
time: 74ms
memory: 15904kb
input:
1 333858 333858 311672 33250 163693 282924 6534 35654 298269 35585 313338 321346 320389 132694 116328 121693 80935 288086 73586 244410 102532 299495 264665 255076 305742 97805 257919 184083 117843 209843 71928 74191 291423 257435 113182 120411 56963 249360 153622 38800 78057 318246 185190 280302 161...
output:
1
result:
ok 1 number(s): "1"
Test #12:
score: 0
Accepted
time: 64ms
memory: 11968kb
input:
1 282720 282720 64561 250134 204183 182485 274148 94838 268960 36791 80511 67872 207198 75629 259217 103065 229545 241948 258647 89327 258181 28678 280869 123833 194934 256570 201025 163867 96784 202050 137324 239570 98234 159716 161687 180374 179505 168008 52008 275217 216822 89708 40193 17336 1673...
output:
2
result:
ok 1 number(s): "2"
Test #13:
score: 0
Accepted
time: 76ms
memory: 14292kb
input:
1 289395 289395 218710 224594 96052 272043 163383 196060 240619 52746 134667 180669 59951 86098 138105 225906 198124 264346 70843 166850 228178 194343 212020 75117 115924 284961 107608 255365 109784 124623 42723 32416 65333 245135 256585 248387 91696 146433 50584 244325 148968 7953 184108 267734 636...
output:
1
result:
ok 1 number(s): "1"
Test #14:
score: 0
Accepted
time: 46ms
memory: 8804kb
input:
1 221015 221015 169030 2925 32928 82781 159619 147631 41578 90251 127661 32214 41077 39303 29552 14211 189327 80031 196358 94065 86091 121172 118574 122020 47059 20779 59880 35848 5186 127948 23212 47536 24246 76511 170202 198778 129088 67944 217008 163442 30668 132342 17819 125331 75177 134934 1507...
output:
2
result:
ok 1 number(s): "2"
Test #15:
score: 0
Accepted
time: 53ms
memory: 9396kb
input:
1 261312 261312 5149 74272 189293 126454 220969 73575 78803 151334 167606 70689 103026 163735 50570 155740 204465 250476 62425 152657 148594 253909 140667 256713 74068 8398 65390 1970 20741 115901 131712 234303 188338 120225 258034 208704 238644 245148 229070 196445 252453 205109 238076 95158 98785 ...
output:
2
result:
ok 1 number(s): "2"
Test #16:
score: 0
Accepted
time: 55ms
memory: 11308kb
input:
1 232155 232155 191076 188799 69446 53809 36036 50274 77999 144896 80233 79514 43853 46951 226608 201943 142387 50093 105530 179418 209215 110369 61156 130989 147574 30940 83346 213361 189535 230977 110384 67153 22602 50365 111381 145427 60827 44223 114269 100188 86714 171623 128858 172077 1808 7073...
output:
1
result:
ok 1 number(s): "1"
Test #17:
score: 0
Accepted
time: 0ms
memory: 3508kb
input:
1 3 3 3 1 1 3 2 2
output:
2
result:
ok 1 number(s): "2"
Test #18:
score: 0
Accepted
time: 0ms
memory: 3516kb
input:
8 5 5 4 5 3 1 1 5 4 3 2 2 5 5 5 3 1 1 3 4 4 5 2 2 5 5 3 1 1 3 5 4 4 5 2 2 5 5 3 2 4 5 1 5 3 2 4 1 3 3 1 1 3 2 2 3 5 5 5 3 2 2 1 1 3 4 4 5 7 7 6 7 3 4 5 1 1 7 6 3 4 5 2 2 5 5 1 2 3 3 2 5 5 1 4 4
output:
2 1 2 2 2 1 1 1
result:
ok 8 numbers
Test #19:
score: 0
Accepted
time: 106ms
memory: 18044kb
input:
1 407563 407563 25959 404448 173067 327641 61972 32257 390470 339703 348937 399800 151619 210552 371976 7741 175893 105024 26831 240101 266983 94292 45503 261708 361731 265270 212795 294272 253179 82134 40984 138072 120316 400294 372285 280834 51428 289945 252389 322797 176094 19756 139692 337590 25...
output:
1
result:
ok 1 number(s): "1"
Test #20:
score: 0
Accepted
time: 127ms
memory: 20616kb
input:
1 488175 488175 408339 213396 275131 270889 203920 238574 357042 98263 245710 349150 314357 269956 326937 20611 206607 221371 107137 324582 156750 98914 389033 152941 211691 350667 195964 27650 328056 438256 245571 222827 213015 161058 16035 405301 55230 245280 285380 421166 147684 151384 166154 102...
output:
1
result:
ok 1 number(s): "1"
Test #21:
score: 0
Accepted
time: 101ms
memory: 18312kb
input:
1 413288 413288 216827 339528 198371 266759 258260 199311 104967 125549 265858 286846 260758 279935 263447 169521 347692 155647 360544 346613 81315 321128 303505 132988 32047 214914 314861 373880 329426 258117 145490 293642 144174 366830 129164 335150 294703 278909 91482 275993 194448 20615 317872 3...
output:
1
result:
ok 1 number(s): "1"
Test #22:
score: 0
Accepted
time: 65ms
memory: 3704kb
input:
61835 1 1 1 1 1 3 1 1 2 2 2 2 2 2 1 1 3 1 1 1 2 2 1 3 1 2 1 2 2 2 2 1 2 1 3 1 1 2 1 2 1 3 1 2 2 1 2 2 2 1 1 2 3 1 1 2 2 1 1 5 2 2 3 3 1 1 2 4 3 3 1 1 2 2 3 3 3 3 2 2 1 1 4 2 2 2 3 3 1 1 5 1 2 2 3 3 1 1 1 5 3 3 2 1 2 1 2 4 1 1 2 3 2 3 3 3 1 1 2 3 2 3 4 2 1 1 2 3 2 3 5 1 1 1 2 3 2 3 1 5 1 1 2 3 3 2 2 ...
output:
2 2 2 2 1 2 1 2 2 2 2 2 2 2 2 1 1 1 2 1 1 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 2 2 2 2 2 1 1 1 2 1 2 2 2 2 2 1 2 2 2 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 2 1 1 1 2 2 2 2 1 2 2 2 2 2 2 2 1 1 1 1 1 2 1 1 2 1 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 2 2 2 2 2 2 1 1 1 1 1 2 1 1 2 2 2 2 2 2 1 2 ...
result:
ok 61835 numbers
Test #23:
score: 0
Accepted
time: 68ms
memory: 3568kb
input:
61835 8 4 3 4 1 1 6 3 5 6 2 4 5 2 9 3 3 4 1 1 2 3 5 2 6 4 5 6 10 2 6 2 4 4 5 6 1 5 3 2 1 3 11 1 3 4 5 5 1 3 6 1 2 4 6 2 1 11 3 1 5 5 2 3 6 2 4 1 4 6 2 10 1 2 3 3 4 1 5 4 6 2 6 5 3 9 5 2 3 3 4 5 6 4 1 2 1 6 4 8 1 2 3 3 4 1 5 4 6 2 6 5 5 7 3 4 6 6 2 3 1 2 5 4 5 1 6 6 1 5 6 6 2 1 4 2 3 5 3 4 7 5 6 1 5 ...
output:
1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 2 1 2 1 2 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 2 1 2 1 2 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 2 1 2 1 2 1 2 2 1 1 1 1 1 1 1 1 1 1 1 1 2 1 2 1 2 1 2 1 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 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 ...
result:
ok 61835 numbers
Test #24:
score: 0
Accepted
time: 46ms
memory: 3636kb
input:
44532 1 13 4 4 3 3 5 5 7 7 2 2 6 6 1 1 2 12 4 4 2 2 5 5 1 1 3 3 7 7 6 6 3 11 4 4 2 2 3 3 6 6 5 5 7 7 1 1 4 10 4 4 7 7 1 1 6 6 3 3 2 2 5 5 5 9 4 4 7 7 1 1 6 6 2 2 5 5 3 3 6 8 1 1 2 2 3 3 4 4 5 5 6 6 7 7 7 7 6 6 2 2 3 3 4 4 5 5 1 1 7 7 8 6 1 1 3 3 2 2 4 4 5 5 6 6 7 7 9 5 4 4 2 2 6 6 1 1 3 3 5 5 7 7 10...
output:
2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 1 2 1 2 1 2 1 2 2 2 2 1 2 1 2 1 2 1 2 1 2 2 2 2 2 2 2 1 2 1 2 1 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 2 1 2 1 2 1 2 2 2 2 2 1 1 1 1 2 1 1 2 1 2 1 2 2 2 2 2 2 2 2 2 1 2 1 2 1 2 1 2 1 2 2 2 2 1 2 1 2 1 2 1 2 2 2 2 2 2 2 2 2 1 2 1 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 ...
result:
ok 44532 numbers
Test #25:
score: 0
Accepted
time: 68ms
memory: 3552kb
input:
9267 56 40 45 14 40 4 29 32 42 40 2 41 4 45 14 29 5 2 41 26 15 27 32 15 17 44 9 8 21 37 20 34 12 3 18 31 43 38 22 11 6 1 47 10 35 24 33 39 23 30 13 7 28 46 25 19 48 36 26 42 27 16 16 5 43 31 18 3 12 34 20 37 21 8 9 44 17 38 22 11 6 1 47 10 35 24 33 39 23 30 13 7 28 46 25 19 48 36 16 12 6 9 4 1 9 6 1...
output:
2 2 2 1 2 2 2 2 2 1 1 2 1 2 1 2 2 2 2 1 2 1 1 2 2 1 2 2 2 2 2 2 2 1 2 2 2 1 1 2 2 2 2 2 2 1 2 2 1 1 1 1 2 2 2 2 2 2 2 1 2 1 2 2 2 2 2 1 2 2 1 1 2 2 2 2 2 2 1 2 1 1 2 2 2 2 1 2 2 1 2 1 1 1 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 1 1 2 2 2 2 2 1 2 2 2 2 2 2 1 1 1 1 1 1 2 1 2 1 1 1 1 2 2 2 1 2 2 2 2 2 2 1 1 2 2 ...
result:
ok 9267 numbers
Test #26:
score: 0
Accepted
time: 76ms
memory: 3608kb
input:
976 632 1130 121 317 743 751 65 851 878 419 699 474 698 683 575 90 608 180 566 506 342 480 394 135 393 43 557 481 139 811 358 634 262 278 736 434 334 558 839 253 774 795 670 768 433 381 503 608 283 315 63 122 466 849 38 177 166 362 87 589 255 266 704 207 200 119 343 100 100 801 801 598 155 684 684 2...
output:
2 2 2 2 1 1 1 1 1 2 2 2 2 2 1 2 2 2 2 2 1 2 2 2 2 2 2 1 2 1 1 1 1 2 2 2 1 2 2 1 2 2 1 2 2 2 2 1 2 2 2 2 2 1 2 2 1 1 1 1 2 1 2 2 2 2 1 1 1 1 2 1 2 2 1 2 2 2 2 1 2 1 1 2 2 1 2 1 2 1 2 2 2 2 1 1 2 2 1 2 1 2 2 2 2 2 2 1 1 2 2 2 2 2 2 2 1 2 1 2 1 2 2 1 1 1 2 1 2 2 1 2 2 2 2 2 2 1 2 1 2 2 1 2 1 2 2 2 1 2 ...
result:
ok 976 numbers
Test #27:
score: 0
Accepted
time: 74ms
memory: 3868kb
input:
99 3866 7186 3585 2981 654 2001 796 3701 5281 20 410 222 914 2955 3263 2108 1584 2761 1075 2662 3910 5180 247 2547 4749 2689 3277 3970 2184 3258 816 3429 2606 2078 4900 3845 1940 3888 1642 3590 4072 783 5499 425 1993 3883 1701 1679 3727 3634 3292 634 2962 1160 333 394 191 1139 2937 4089 4093 954 440...
output:
1 2 2 2 1 2 1 2 2 2 2 2 1 2 2 2 2 2 1 1 2 2 2 2 1 1 2 2 2 1 1 1 2 1 2 1 2 2 2 2 2 2 1 2 2 1 1 1 2 2 2 2 2 2 2 1 1 1 1 2 2 2 1 2 2 1 2 1 2 1 2 2 2 2 2 2 1 1 1 2 1 2 2 2 2 2 1 2 2 2 1 2 2 2 1 1 2 2 1
result:
ok 99 numbers
Test #28:
score: 0
Accepted
time: 95ms
memory: 6112kb
input:
9 89540 79058 28982 17022 20893 46155 7120 11741 11346 80022 82973 21904 73715 76689 45397 38222 55 75272 53322 9623 52207 9863 8964 66380 65350 58777 65336 35200 9956 33793 77640 8465 35105 13730 36649 77456 40694 31545 16652 75819 56314 51502 71137 68134 42316 38844 36501 77740 52706 64171 36421 5...
output:
1 2 2 2 2 2 2 2 1
result:
ok 9 numbers
Extra Test:
score: 0
Extra Test Passed