QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#836545 | #9924. Reconstruction | ucup-team159# | RE | 584ms | 153332kb | C++23 | 21.2kb | 2024-12-28 23:51:05 | 2024-12-28 23:51:06 |
Judging History
answer
#line 1 "ucup3-23/J/main.cpp"
#define YOSUPO_AVX2_PRAGMA
// #undef YOSUPO_LOCAL
#line 2 "/home/vscode/yosupo-library/src/yosupo/fastio.hpp"
#include <unistd.h>
#include <algorithm>
#include <array>
#include <bit>
#include <cassert>
#include <cctype>
#include <cstdint>
#include <cstring>
#include <sstream>
#include <string>
#include <type_traits>
#include <vector>
#line 2 "/home/vscode/yosupo-library/src/yosupo/internal_type_traits.hpp"
#line 5 "/home/vscode/yosupo-library/src/yosupo/internal_type_traits.hpp"
namespace yosupo {
namespace internal {
template <class T>
using is_signed_int128 =
typename std::conditional<std::is_same<T, __int128_t>::value ||
std::is_same<T, __int128>::value,
std::true_type,
std::false_type>::type;
template <class T>
using is_unsigned_int128 =
typename std::conditional<std::is_same<T, __uint128_t>::value ||
std::is_same<T, unsigned __int128>::value,
std::true_type,
std::false_type>::type;
template <class T>
using make_unsigned_int128 =
typename std::conditional<std::is_same<T, __int128_t>::value,
__uint128_t,
unsigned __int128>;
template <class T>
using is_integral =
typename std::conditional<std::is_integral<T>::value ||
internal::is_signed_int128<T>::value ||
internal::is_unsigned_int128<T>::value,
std::true_type,
std::false_type>::type;
template <class T>
using is_signed_int = typename std::conditional<(is_integral<T>::value &&
std::is_signed<T>::value) ||
is_signed_int128<T>::value,
std::true_type,
std::false_type>::type;
template <class T>
using is_unsigned_int =
typename std::conditional<(is_integral<T>::value &&
std::is_unsigned<T>::value) ||
is_unsigned_int128<T>::value,
std::true_type,
std::false_type>::type;
template <class T>
using to_unsigned = typename std::conditional<
is_signed_int128<T>::value,
make_unsigned_int128<T>,
typename std::conditional<std::is_signed<T>::value,
std::make_unsigned<T>,
std::common_type<T>>::type>::type;
template <class T>
using is_integral_t = std::enable_if_t<is_integral<T>::value>;
template <class T>
using is_signed_int_t = std::enable_if_t<is_signed_int<T>::value>;
template <class T>
using is_unsigned_int_t = std::enable_if_t<is_unsigned_int<T>::value>;
template <class T> using to_unsigned_t = typename to_unsigned<T>::type;
} // namespace internal
} // namespace yosupo
#line 17 "/home/vscode/yosupo-library/src/yosupo/fastio.hpp"
namespace yosupo {
struct Scanner {
public:
Scanner(const Scanner&) = delete;
Scanner& operator=(const Scanner&) = delete;
Scanner(FILE* fp) : fd(fileno(fp)) { line[0] = 127; }
void read() {}
template <class H, class... T> void read(H& h, T&... t) {
bool f = read_single(h);
assert(f);
read(t...);
}
int read_unsafe() { return 0; }
template <class H, class... T> int read_unsafe(H& h, T&... t) {
bool f = read_single(h);
if (!f) return 0;
return 1 + read_unsafe(t...);
}
int close() { return ::close(fd); }
private:
static constexpr int SIZE = 1 << 15;
int fd = -1;
std::array<char, SIZE + 1> line;
int st = 0, ed = 0;
bool eof = false;
bool read_single(std::string& ref) {
if (!skip_space()) return false;
ref = "";
while (true) {
char c = top();
if (c <= ' ') break;
ref += c;
st++;
}
return true;
}
bool read_single(double& ref) {
std::string s;
if (!read_single(s)) return false;
ref = std::stod(s);
return true;
}
template <class T,
std::enable_if_t<std::is_same<T, char>::value>* = nullptr>
bool read_single(T& ref) {
if (!skip_space<50>()) return false;
ref = top();
st++;
return true;
}
template <class T,
internal::is_signed_int_t<T>* = nullptr,
std::enable_if_t<!std::is_same<T, char>::value>* = nullptr>
bool read_single(T& sref) {
using U = internal::to_unsigned_t<T>;
if (!skip_space<50>()) return false;
bool neg = false;
if (line[st] == '-') {
neg = true;
st++;
}
U ref = 0;
do {
ref = 10 * ref + (line[st++] & 0x0f);
} while (line[st] >= '0');
sref = neg ? -ref : ref;
return true;
}
template <class U,
internal::is_unsigned_int_t<U>* = nullptr,
std::enable_if_t<!std::is_same<U, char>::value>* = nullptr>
bool read_single(U& ref) {
if (!skip_space<50>()) return false;
ref = 0;
do {
ref = 10 * ref + (line[st++] & 0x0f);
} while (line[st] >= '0');
return true;
}
bool reread() {
if (ed - st >= 50) return true;
if (st > SIZE / 2) {
std::memmove(line.data(), line.data() + st, ed - st);
ed -= st;
st = 0;
}
if (eof) return false;
auto u = ::read(fd, line.data() + ed, SIZE - ed);
if (u == 0) {
eof = true;
line[ed] = '\0';
u = 1;
}
ed += int(u);
line[ed] = char(127);
return true;
}
char top() {
if (st == ed) {
bool f = reread();
assert(f);
}
return line[st];
}
template <int TOKEN_LEN = 0> bool skip_space() {
while (true) {
while (line[st] <= ' ') st++;
if (ed - st > TOKEN_LEN) return true;
if (st > ed) st = ed;
for (auto i = st; i < ed; i++) {
if (line[i] <= ' ') return true;
}
if (!reread()) return false;
}
}
};
struct Printer {
public:
template <char sep = ' ', bool F = false> void write() {}
template <char sep = ' ', bool F = false, class H, class... T>
void write(const H& h, const T&... t) {
if (F) write_single(sep);
write_single(h);
write<true>(t...);
}
template <char sep = ' ', class... T> void writeln(const T&... t) {
write<sep>(t...);
write_single('\n');
}
Printer(FILE* _fp) : fd(fileno(_fp)) {}
~Printer() { flush(); }
int close() {
flush();
return ::close(fd);
}
void flush() {
if (pos) {
auto res = ::write(fd, line.data(), pos);
assert(res != -1);
pos = 0;
}
}
private:
static std::array<std::array<char, 2>, 100> small;
static std::array<unsigned long long, 20> tens;
static constexpr size_t SIZE = 1 << 15;
int fd;
std::array<char, SIZE> line;
size_t pos = 0;
std::stringstream ss;
template <class T,
std::enable_if_t<std::is_same<char, T>::value>* = nullptr>
void write_single(const T& val) {
if (pos == SIZE) flush();
line[pos++] = val;
}
template <class T,
internal::is_signed_int_t<T>* = nullptr,
std::enable_if_t<!std::is_same<char, T>::value>* = nullptr>
void write_single(const T& val) {
using U = internal::to_unsigned_t<T>;
if (val == 0) {
write_single('0');
return;
}
if (pos > SIZE - 50) flush();
U uval = val;
if (val < 0) {
write_single('-');
uval = -uval;
}
write_unsigned(uval);
}
template <class U,
internal::is_unsigned_int_t<U>* = nullptr,
std::enable_if_t<!std::is_same<char, U>::value>* = nullptr>
void write_single(U uval) {
if (uval == 0) {
write_single('0');
return;
}
if (pos > SIZE - 50) flush();
write_unsigned(uval);
}
static int calc_len(uint64_t x) {
int i = ((63 - std::countl_zero(x)) * 3 + 3) / 10;
if (x < tens[i])
return i;
else
return i + 1;
}
template <class U,
internal::is_unsigned_int_t<U>* = nullptr,
std::enable_if_t<2 >= sizeof(U)>* = nullptr>
void write_unsigned(U uval) {
size_t len = calc_len(uval);
pos += len;
char* ptr = line.data() + pos;
while (uval >= 100) {
ptr -= 2;
memcpy(ptr, small[uval % 100].data(), 2);
uval /= 100;
}
if (uval >= 10) {
memcpy(ptr - 2, small[uval].data(), 2);
} else {
*(ptr - 1) = char('0' + uval);
}
}
template <class U,
internal::is_unsigned_int_t<U>* = nullptr,
std::enable_if_t<4 == sizeof(U)>* = nullptr>
void write_unsigned(U uval) {
std::array<char, 8> buf;
memcpy(buf.data() + 6, small[uval % 100].data(), 2);
memcpy(buf.data() + 4, small[uval / 100 % 100].data(), 2);
memcpy(buf.data() + 2, small[uval / 10000 % 100].data(), 2);
memcpy(buf.data() + 0, small[uval / 1000000 % 100].data(), 2);
if (uval >= 100000000) {
if (uval >= 1000000000) {
memcpy(line.data() + pos, small[uval / 100000000 % 100].data(),
2);
pos += 2;
} else {
line[pos] = char('0' + uval / 100000000);
pos++;
}
memcpy(line.data() + pos, buf.data(), 8);
pos += 8;
} else {
size_t len = calc_len(uval);
memcpy(line.data() + pos, buf.data() + (8 - len), len);
pos += len;
}
}
template <class U,
internal::is_unsigned_int_t<U>* = nullptr,
std::enable_if_t<8 == sizeof(U)>* = nullptr>
void write_unsigned(U uval) {
size_t len = calc_len(uval);
pos += len;
char* ptr = line.data() + pos;
while (uval >= 100) {
ptr -= 2;
memcpy(ptr, small[uval % 100].data(), 2);
uval /= 100;
}
if (uval >= 10) {
memcpy(ptr - 2, small[uval].data(), 2);
} else {
*(ptr - 1) = char('0' + uval);
}
}
template <
class U,
std::enable_if_t<internal::is_unsigned_int128<U>::value>* = nullptr>
void write_unsigned(U uval) {
static std::array<char, 50> buf;
size_t len = 0;
while (uval > 0) {
buf[len++] = char((uval % 10) + '0');
uval /= 10;
}
std::reverse(buf.begin(), buf.begin() + len);
memcpy(line.data() + pos, buf.data(), len);
pos += len;
}
void write_single(const std::string& s) {
for (char c : s) write_single(c);
}
void write_single(const char* s) {
size_t len = strlen(s);
for (size_t i = 0; i < len; i++) write_single(s[i]);
}
template <class T> void write_single(const std::vector<T>& val) {
auto n = val.size();
for (size_t i = 0; i < n; i++) {
if (i) write_single(' ');
write_single(val[i]);
}
}
};
inline std::array<std::array<char, 2>, 100> Printer::small = [] {
std::array<std::array<char, 2>, 100> table;
for (int i = 0; i <= 99; i++) {
table[i][1] = char('0' + (i % 10));
table[i][0] = char('0' + (i / 10 % 10));
}
return table;
}();
inline std::array<unsigned long long, 20> Printer::tens = [] {
std::array<unsigned long long, 20> table;
for (int i = 0; i < 20; i++) {
table[i] = 1;
for (int j = 0; j < i; j++) {
table[i] *= 10;
}
}
return table;
}();
} // namespace yosupo
#line 1 "/home/vscode/ac-library/atcoder/dsu.hpp"
#line 7 "/home/vscode/ac-library/atcoder/dsu.hpp"
namespace atcoder {
// Implement (union by size) + (path compression)
// Reference:
// Zvi Galil and Giuseppe F. Italiano,
// Data structures and algorithms for disjoint set union problems
struct dsu {
public:
dsu() : _n(0) {}
explicit dsu(int n) : _n(n), parent_or_size(n, -1) {}
int merge(int a, int b) {
assert(0 <= a && a < _n);
assert(0 <= b && b < _n);
int x = leader(a), y = leader(b);
if (x == y) return x;
if (-parent_or_size[x] < -parent_or_size[y]) std::swap(x, y);
parent_or_size[x] += parent_or_size[y];
parent_or_size[y] = x;
return x;
}
bool same(int a, int b) {
assert(0 <= a && a < _n);
assert(0 <= b && b < _n);
return leader(a) == leader(b);
}
int leader(int a) {
assert(0 <= a && a < _n);
if (parent_or_size[a] < 0) return a;
return parent_or_size[a] = leader(parent_or_size[a]);
}
int size(int a) {
assert(0 <= a && a < _n);
return -parent_or_size[leader(a)];
}
std::vector<std::vector<int>> groups() {
std::vector<int> leader_buf(_n), group_size(_n);
for (int i = 0; i < _n; i++) {
leader_buf[i] = leader(i);
group_size[leader_buf[i]]++;
}
std::vector<std::vector<int>> result(_n);
for (int i = 0; i < _n; i++) {
result[i].reserve(group_size[i]);
}
for (int i = 0; i < _n; i++) {
result[leader_buf[i]].push_back(i);
}
result.erase(
std::remove_if(result.begin(), result.end(),
[&](const std::vector<int>& v) { return v.empty(); }),
result.end());
return result;
}
private:
int _n;
// root node: -1 * component size
// otherwise: parent
std::vector<int> parent_or_size;
};
} // namespace atcoder
#line 6 "ucup3-23/J/main.cpp"
using namespace yosupo;
#line 2 "ucup3-23/J/base.hpp"
#ifdef YOSUPO_AVX2_PRAGMA
#line 5 "ucup3-23/J/base.hpp"
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#endif
#line 11 "ucup3-23/J/base.hpp"
#include <bitset>
#line 13 "ucup3-23/J/base.hpp"
#include <cmath>
#include <cstdio>
#line 16 "ucup3-23/J/base.hpp"
#include <iostream>
#include <map>
#include <queue>
#include <ranges>
#include <set>
#line 22 "ucup3-23/J/base.hpp"
#include <utility>
#line 24 "ucup3-23/J/base.hpp"
using std::abs, std::pow, std::sqrt;
using std::array, std::vector, std::string, std::queue, std::deque;
using std::countl_zero, std::countl_one, std::countr_zero, std::countr_one;
using std::istream, std::ostream, std::cerr, std::endl;
using std::min, std::max, std::swap;
using std::pair, std::tuple, std::bitset;
using std::popcount;
using std::priority_queue, std::set, std::multiset, std::map;
using std::views::iota, std::views::reverse;
namespace ranges = std::ranges;
using ranges::sort, ranges::copy_n;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
#ifdef YOSUPO_LOCAL
inline ostream& operator<<(ostream& os, __int128_t x) {
if (x < 0) {
os << "-";
x *= -1;
}
if (x == 0) {
return os << "0";
}
string s;
while (x) {
s += char(x % 10 + '0');
x /= 10;
}
ranges::reverse(s);
return os << s;
}
inline ostream& operator<<(ostream& os, __uint128_t x) {
if (x == 0) {
return os << "0";
}
string s;
while (x) {
s += char(x % 10 + '0');
x /= 10;
}
ranges::reverse(s);
return os << s;
}
template <class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p);
template <class T> ostream& operator<<(ostream& os, const V<T>& v);
template <class T> ostream& operator<<(ostream& os, const deque<T>& v);
template <class T, size_t N>
ostream& operator<<(ostream& os, const array<T, N>& a);
template <class T> ostream& operator<<(ostream& os, const set<T>& s);
template <class T, class U>
ostream& operator<<(ostream& os, const map<T, U>& m);
template <class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
return os << "P(" << p.first << ", " << p.second << ")";
}
template <class T> ostream& operator<<(ostream& os, const V<T>& v) {
os << "[";
bool f = false;
for (auto d : v) {
if (f) os << ", ";
f = true;
os << d;
}
return os << "]";
}
template <class T> ostream& operator<<(ostream& os, const deque<T>& v) {
os << "[";
bool f = false;
for (auto d : v) {
if (f) os << ", ";
f = true;
os << d;
}
return os << "]";
}
template <class T, size_t N>
ostream& operator<<(ostream& os, const array<T, N>& a) {
os << "[";
bool f = false;
for (auto d : a) {
if (f) os << ", ";
f = true;
os << d;
}
return os << "]";
}
template <class T> ostream& operator<<(ostream& os, const set<T>& s) {
os << "{";
bool f = false;
for (auto d : s) {
if (f) os << ", ";
f = true;
os << d;
}
return os << "}";
}
template <class T> ostream& operator<<(ostream& os, const multiset<T>& s) {
os << "{";
bool f = false;
for (auto d : s) {
if (f) os << ", ";
f = true;
os << d;
}
return os << "}";
}
template <class T, class U>
ostream& operator<<(ostream& os, const map<T, U>& s) {
os << "{";
bool f = false;
for (auto p : s) {
if (f) os << ", ";
f = true;
os << p.first << ": " << p.second;
}
return os << "}";
}
struct PrettyOS {
ostream& os;
bool first;
template <class T> auto operator<<(T&& x) {
if (!first) os << ", ";
first = false;
os << x;
return *this;
}
};
template <class... T> void dbg0(T&&... t) {
(PrettyOS{cerr, true} << ... << t);
}
#define dbg(...) \
do { \
cerr << __LINE__ << " : " << #__VA_ARGS__ << " = "; \
dbg0(__VA_ARGS__); \
cerr << endl; \
} while (false);
#else
#define dbg(...)
#endif
#line 9 "ucup3-23/J/main.cpp"
Scanner sc = Scanner(stdin);
Printer pr = Printer(stdout);
int main() {
int n;
sc.read(n);
VV<int> t1(n), t2(n);
for (int _ : iota(0, n - 1)) {
int u, v;
sc.read(u, v);
u--; v--;
t1[u].push_back(v);
t1[v].push_back(u);
}
for (int _ : iota(0, n - 1)) {
int u, v;
sc.read(u, v);
u--;
v--;
t2[u].push_back(v);
t2[v].push_back(u);
}
V<int> par1(n, -1), depth1(n, 0);
{
auto dfs = [&](auto self, int u, int p) -> void {
for (int v : t1[u]) {
if (v == p) continue;
par1[v] = u;
depth1[v] = depth1[u] + 1;
self(self, v, u);
}
};
dfs(dfs, 0, -1);
}
V<int> imos(n, 0);
{
V<bool> vis(n, false);
auto dfs = [&](auto self, int u, int p) -> void {
vis[u] = true;
for (int v : t2[u]) {
if (v == p) continue;
bool near = (par1[u] == v || par1[v] == u);
if (near) {
self(self, v, u);
} else {
int w = (depth1[u] > depth1[v] ? par1[u] : par1[v]);
bool sub0 = vis[w];
self(self, v, u);
bool sub1 = vis[w];
bool sub = !sub0 && sub1;
if (sub) {
imos[v]--;
} else {
imos[0]--;
imos[v]++;
}
}
}
};
dfs(dfs, 0, -1);
auto dfs2 = [&](auto self, int u, int p) -> void {
for (int v : t2[u]) {
if (v == p) continue;
imos[v] += imos[u];
self(self, v, u);
}
};
dfs2(dfs2, 0, -1);
dbg(imos);
}
atcoder::dsu uf(n);
int r = -1;
for (int i : iota(0, n)) {
if (imos[i] == 0) {
r = i;
break;
}
}
auto dfs = [&](auto self, int u, int p) -> bool {
set<int> st;
for (int v : t2[u]) {
if (v == p) continue;
if (!self(self, v, u)) return false;
st.insert(uf.leader(v));
}
for (int v : t1[u]) {
int w = uf.leader(v);
if (!st.count(w)) continue;
uf.merge(u, v);
st.erase(w);
}
if (!st.empty()) return false;
return true;
};
bool ok = dfs(dfs, r, -1);
dbg(r, ok);
for (int i : iota(0, n)) {
if (imos[i] == 0 && ok) {
pr.write('1');
} else {
pr.write('0');
}
}
pr.writeln();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3524kb
input:
3 1 2 2 3 2 1 1 3
output:
001
result:
ok single line: '001'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
6 1 3 3 4 3 6 4 5 5 2 1 3 1 4 4 5 5 2 3 6
output:
010110
result:
ok single line: '010110'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3748kb
input:
1
output:
1
result:
ok single line: '1'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
2 1 2 1 2
output:
11
result:
ok single line: '11'
Test #5:
score: 0
Accepted
time: 462ms
memory: 86328kb
input:
500000 321614 78209 64619 204431 81539 336200 128603 201377 132521 391792 41587 137224 174146 381680 341915 451206 493371 256005 259794 168656 161914 462290 105839 333679 377214 267008 283062 457340 219692 196741 123276 321510 473789 410796 498171 203543 178249 456921 255509 449152 294196 457566 277...
output:
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
ok single line: '000000000000000000000000000000...0000000000000000000000000000000'
Test #6:
score: 0
Accepted
time: 360ms
memory: 67088kb
input:
500000 36024 87195 108586 421467 431172 367732 493985 46886 213597 28307 211267 46590 362114 441339 277065 115859 103713 161698 349213 41745 185934 19274 490316 496516 475711 279386 296442 146503 89733 449936 197415 385594 325021 418416 335226 171591 201788 138457 60931 108388 58772 112816 371138 14...
output:
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
ok single line: '000000000000000000000000000000...0000000000000000000000000000000'
Test #7:
score: 0
Accepted
time: 347ms
memory: 66824kb
input:
500000 310317 190907 69501 399906 150116 313251 246687 111703 184096 396547 53772 260805 227586 215088 36494 125548 378767 252795 276318 297811 427118 345684 249477 42722 228070 490399 180663 323186 354634 11504 263905 232028 236183 306162 272415 455913 375552 467155 430114 476865 461198 4954 329182...
output:
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
ok single line: '000000000000000000000000000000...0000000000000000000000000000000'
Test #8:
score: 0
Accepted
time: 351ms
memory: 66880kb
input:
500000 452851 19638 27265 237427 26968 275079 452156 83840 332697 93577 466755 20005 348018 178526 64265 14018 378010 176281 388553 147130 294415 395043 143559 6383 279517 164842 96091 142314 220338 172667 5727 375365 473038 398633 93702 338887 290595 353499 228872 259575 439511 454445 437231 201278...
output:
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
ok single line: '000000000000000000000000000000...0000000000000000000000000000000'
Test #9:
score: 0
Accepted
time: 347ms
memory: 66788kb
input:
500000 60928 107647 235760 497822 304252 117620 105711 179233 203340 377898 155972 416233 478313 397136 281935 101102 321117 469553 23853 66761 446952 107534 441875 265132 26312 196083 477635 287906 39638 187977 376375 334164 7510 321386 56303 439673 166824 327050 56421 464413 163256 254605 420933 4...
output:
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...
result:
ok single line: '111111111111111111111111111111...1111111111111111111111111111111'
Test #10:
score: 0
Accepted
time: 584ms
memory: 153332kb
input:
500000 133454 88585 44667 353827 280459 188270 354784 26487 59928 473772 90470 153344 469518 134293 465532 367839 206155 219620 5921 261069 413040 75688 349642 314325 187507 192838 249832 392425 211451 225725 441947 29595 166233 454731 289716 486004 466294 62062 427321 130791 89032 184003 427010 462...
output:
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...
result:
ok single line: '111111111111111111111111111111...1111111111111111111111111111111'
Test #11:
score: 0
Accepted
time: 483ms
memory: 79372kb
input:
500000 167897 133130 105650 167897 210511 291114 167897 462679 344180 167897 167897 458809 167897 76305 167897 124960 64535 239234 167897 286004 167897 247571 180738 244382 167897 18787 226792 167897 107623 167897 347463 38779 337154 167897 77712 167897 189184 39539 167897 102046 167897 292650 16789...
output:
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...
result:
ok single line: '111111111111111111111111111111...1111111111111111111111111111111'
Test #12:
score: 0
Accepted
time: 479ms
memory: 79324kb
input:
499999 161910 405465 176243 214115 161910 393078 161910 174157 448600 112022 133961 469029 398832 161910 161910 179054 374081 266412 50467 235815 161910 200357 212580 161910 257831 188909 386115 161910 161910 259180 177533 360956 199521 210629 291927 161910 35549 161910 29040 161910 307767 161910 16...
output:
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...
result:
ok single line: '111111111111111111111111111111...1111111111111111111111111111111'
Test #13:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
4 4 2 4 3 1 4 3 2 4 3 1 3
output:
0000
result:
ok single line: '0000'
Test #14:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
5 5 2 2 1 4 3 2 3 3 5 4 3 2 3 1 2
output:
00001
result:
ok single line: '00001'
Test #15:
score: 0
Accepted
time: 0ms
memory: 3816kb
input:
5 1 2 3 2 4 5 5 3 5 4 2 5 1 3 1 2
output:
00000
result:
ok single line: '00000'
Test #16:
score: 0
Accepted
time: 1ms
memory: 3604kb
input:
6 6 2 2 5 5 1 5 3 6 4 1 4 5 3 4 6 6 2 5 2
output:
100000
result:
ok single line: '100000'
Test #17:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
6 4 3 6 2 4 5 1 6 4 6 6 4 5 3 3 1 5 2 6 5
output:
000000
result:
ok single line: '000000'
Test #18:
score: 0
Accepted
time: 0ms
memory: 3480kb
input:
6 2 5 3 1 5 3 6 2 4 5 3 6 4 2 1 5 2 5 1 3
output:
000000
result:
ok single line: '000000'
Test #19:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
6 1 2 5 3 6 4 1 5 5 4 2 5 3 1 5 4 2 6 1 4
output:
000000
result:
ok single line: '000000'
Test #20:
score: 0
Accepted
time: 0ms
memory: 3540kb
input:
10 9 2 1 5 6 4 8 5 2 1 7 2 3 8 5 10 5 4 2 1 1 7 5 10 5 6 3 1 4 10 1 5 9 1 8 7
output:
0000000000
result:
ok single line: '0000000000'
Test #21:
score: 0
Accepted
time: 0ms
memory: 3808kb
input:
10 9 10 8 4 7 2 8 7 4 6 1 3 4 3 5 6 4 9 10 8 9 7 8 9 6 2 9 4 1 8 3 6 1 5 8 6
output:
0000000000
result:
ok single line: '0000000000'
Test #22:
score: 0
Accepted
time: 0ms
memory: 3528kb
input:
10 9 5 2 3 1 7 2 8 2 10 4 2 9 10 2 1 6 3 7 2 7 5 8 10 3 6 6 8 8 9 6 2 2 4 2 1
output:
0000000000
result:
ok single line: '0000000000'
Test #23:
score: 0
Accepted
time: 0ms
memory: 3480kb
input:
10 7 3 4 3 8 4 7 1 5 6 4 2 4 10 5 4 4 9 3 5 5 10 5 9 7 3 6 7 5 4 8 4 1 3 5 2
output:
0000000000
result:
ok single line: '0000000000'
Test #24:
score: 0
Accepted
time: 0ms
memory: 3808kb
input:
10 5 4 4 10 10 3 2 6 9 8 8 10 6 1 10 1 7 10 7 5 1 7 10 1 10 6 9 5 4 7 3 1 6 2 8 1
output:
0000000000
result:
ok single line: '0000000000'
Test #25:
score: 0
Accepted
time: 246ms
memory: 66760kb
input:
500000 449813 382048 267805 409476 197021 142943 96520 14286 190014 29290 99779 205030 448520 397521 268137 275440 496824 335557 16533 145194 312001 288682 216668 141561 412086 264971 8513 23395 249165 57914 236009 266421 478739 117971 378416 334959 30 103303 190090 265064 77784 425899 8527 7260 190...
output:
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
ok single line: '000000000000000000000000000000...0000000000000000000000000000000'
Test #26:
score: 0
Accepted
time: 258ms
memory: 66344kb
input:
500000 436359 153184 32329 245730 128439 94252 481002 164655 417808 461117 293685 420500 194999 195958 280286 312282 446105 64214 160786 313954 441934 232342 217798 17452 381699 240754 172009 261706 138562 497017 54835 71129 260680 242928 221836 99517 319330 405859 92116 178949 348302 78763 412522 3...
output:
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
ok single line: '000000000000000000000000000000...0000000000000000000000000000000'
Test #27:
score: 0
Accepted
time: 236ms
memory: 66368kb
input:
500000 383544 231141 285165 154570 122599 89711 46649 305329 398481 286225 419333 167044 266408 16517 157370 342641 172616 100599 451993 33673 159972 316911 123808 441854 48681 185685 1689 404615 25385 492198 187713 81217 18819 286913 330555 195588 395991 142350 53980 186664 349053 41494 115371 4848...
output:
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
ok single line: '000000000000000000000000000000...0000000000000000000000000000000'
Test #28:
score: 0
Accepted
time: 252ms
memory: 66000kb
input:
500000 437813 323962 324213 393428 83291 203367 444398 289380 443031 481209 69006 370164 382855 266949 249819 418632 142657 198142 227961 248299 245051 260019 331799 376496 436608 352312 306698 65006 297667 209503 282247 439175 92723 132762 66063 445253 159315 61140 344595 383848 488186 111442 36311...
output:
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
ok single line: '000000000000000000000000000000...0000000000000000000000000000000'
Test #29:
score: 0
Accepted
time: 198ms
memory: 68244kb
input:
500000 443481 69310 81987 31083 350373 433156 63308 244157 61628 309800 435781 107127 217715 425206 361237 429146 232558 223217 439350 90619 417524 147338 284888 67603 94896 70841 236698 425487 388632 276131 316983 51040 162034 56727 335486 77859 148246 173062 39657 436405 68722 276656 358284 69076 ...
output:
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
ok single line: '000000000000000000000000000000...0000000000000000000000000000000'
Test #30:
score: 0
Accepted
time: 212ms
memory: 68032kb
input:
500000 216800 474916 255518 400474 434284 115244 1985 432478 398197 184716 278162 414983 262912 427124 168526 291145 162657 405850 372423 487503 98249 412887 177396 200269 164161 200294 232588 118959 76868 1511 459335 399309 182103 360926 104187 75557 494416 168425 14894 230053 376283 372973 379449 ...
output:
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
ok single line: '000000000000000000000000000000...0000000000000000000000000000000'
Test #31:
score: 0
Accepted
time: 169ms
memory: 69888kb
input:
500000 129908 181285 247972 254107 21450 32185 484769 242965 355740 188535 207085 446844 360620 29318 402339 196327 148137 482471 339184 147698 53648 245350 381348 97244 349385 423200 421510 243468 485318 297421 338674 307850 95730 316255 85531 361113 238665 217923 436371 467095 253039 496000 407840...
output:
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
ok single line: '000000000000000000000000000000...0000000000000000000000000000000'
Test #32:
score: 0
Accepted
time: 268ms
memory: 66164kb
input:
500000 400687 155492 144221 323468 218204 494237 391809 256925 317411 459870 295418 336450 398270 344329 296440 113027 287397 201370 16825 495696 23487 157882 313549 276131 168897 116830 183472 454694 316758 403067 68845 495888 124531 451565 424366 248526 431464 205058 317235 494211 326062 159714 41...
output:
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
ok single line: '000000000000000000000000000000...0000000000000000000000000000000'
Test #33:
score: 0
Accepted
time: 139ms
memory: 71056kb
input:
500000 203829 75411 55235 389414 316162 427357 497415 386988 473462 434719 58669 273215 123197 304988 493876 461323 116153 420890 306075 477844 31279 274564 460706 115100 360768 458006 322608 406908 38993 367071 130497 443709 248473 220283 372992 98644 44225 284213 336644 283299 346314 406997 123738...
output:
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
ok single line: '000000000000000000000000000000...0000000000000000000000000000000'
Test #34:
score: 0
Accepted
time: 267ms
memory: 79304kb
input:
500000 242660 386154 211753 485343 169536 327281 23018 58601 227943 213529 397224 100882 107969 164965 30078 434321 302391 144865 489002 484336 287165 5922 433048 416246 8224 171798 400682 74417 220479 148166 396156 173297 493955 466764 408490 44671 318635 89875 128971 328174 369258 350792 415068 16...
output:
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
ok single line: '000000000000000000000000000000...0000000000000000000000000000000'
Test #35:
score: -100
Runtime Error
input:
500000 89729 46453 89729 424405 89729 329263 199363 33750 241918 89729 218219 407035 471196 208242 89729 138544 141501 89729 357638 430194 267888 475362 22301 148916 151438 33994 89729 67567 273456 89729 295901 105524 89729 174177 386293 89729 310494 315600 413870 89729 305099 15716 172120 89729 433...