QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#723917 | #4423. AMPPZ in the times of disease | maspy | AC ✓ | 2970ms | 97076kb | C++23 | 19.4kb | 2024-11-08 03:34:53 | 2024-11-08 03:34:53 |
Judging History
answer
#line 1 "library/my_template.hpp"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pi = pair<ll, ll>;
using vi = vector<ll>;
using u32 = unsigned int;
using u64 = unsigned long long;
using i128 = __int128;
template <class T>
using vc = vector<T>;
template <class T>
using vvc = vector<vc<T>>;
template <class T>
using vvvc = vector<vvc<T>>;
template <class T>
using vvvvc = vector<vvvc<T>>;
template <class T>
using vvvvvc = vector<vvvvc<T>>;
template <class T>
using pq = priority_queue<T>;
template <class T>
using pqg = priority_queue<T, vector<T>, greater<T>>;
#define vec(type, name, ...) vector<type> name(__VA_ARGS__)
#define vv(type, name, h, ...) \
vector<vector<type>> name(h, vector<type>(__VA_ARGS__))
#define vvv(type, name, h, w, ...) \
vector<vector<vector<type>>> name( \
h, vector<vector<type>>(w, vector<type>(__VA_ARGS__)))
#define vvvv(type, name, a, b, c, ...) \
vector<vector<vector<vector<type>>>> name( \
a, vector<vector<vector<type>>>( \
b, vector<vector<type>>(c, vector<type>(__VA_ARGS__))))
// https://trap.jp/post/1224/
#define FOR1(a) for (ll _ = 0; _ < ll(a); ++_)
#define FOR2(i, a) for (ll i = 0; i < ll(a); ++i)
#define FOR3(i, a, b) for (ll i = a; i < ll(b); ++i)
#define FOR4(i, a, b, c) for (ll i = a; i < ll(b); i += (c))
#define FOR1_R(a) for (ll i = (a)-1; i >= ll(0); --i)
#define FOR2_R(i, a) for (ll i = (a)-1; i >= ll(0); --i)
#define FOR3_R(i, a, b) for (ll i = (b)-1; i >= ll(a); --i)
#define FOR4_R(i, a, b, c) for (ll i = (b)-1; i >= ll(a); i -= (c))
#define overload4(a, b, c, d, e, ...) e
#define FOR(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define FOR_R(...) \
overload4(__VA_ARGS__, FOR4_R, FOR3_R, FOR2_R, FOR1_R)(__VA_ARGS__)
#define FOR_subset(t, s) for (ll t = s; t >= 0; t = (t == 0 ? -1 : (t - 1) & s))
#define all(x) x.begin(), x.end()
#define len(x) ll(x.size())
#define elif else if
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define stoi stoll
template <typename T>
T SUM(vector<T> &A) {
T sum = T(0);
for (auto &&a: A) sum += a;
return sum;
}
#define MIN(v) *min_element(all(v))
#define MAX(v) *max_element(all(v))
#define LB(c, x) distance((c).begin(), lower_bound(all(c), (x)))
#define UB(c, x) distance((c).begin(), upper_bound(all(c), (x)))
#define UNIQUE(x) sort(all(x)), x.erase(unique(all(x)), x.end())
int popcnt(int x) { return __builtin_popcount(x); }
int popcnt(u32 x) { return __builtin_popcount(x); }
int popcnt(ll x) { return __builtin_popcountll(x); }
int popcnt(u64 x) { return __builtin_popcountll(x); }
// (0, 1, 2, 3, 4) -> (-1, 0, 1, 1, 2)
int topbit(int x) { return (x == 0 ? -1 : 31 - __builtin_clz(x)); }
int topbit(u32 x) { return (x == 0 ? -1 : 31 - __builtin_clz(x)); }
int topbit(ll x) { return (x == 0 ? -1 : 63 - __builtin_clzll(x)); }
int topbit(u64 x) { return (x == 0 ? -1 : 63 - __builtin_clzll(x)); }
// (0, 1, 2, 3, 4) -> (-1, 0, 1, 0, 2)
int lowbit(int x) { return (x == 0 ? -1 : __builtin_ctz(x)); }
int lowbit(u32 x) { return (x == 0 ? -1 : __builtin_ctz(x)); }
int lowbit(ll x) { return (x == 0 ? -1 : __builtin_ctzll(x)); }
int lowbit(u64 x) { return (x == 0 ? -1 : __builtin_ctzll(x)); }
template <typename T, typename U>
T ceil(T x, U y) {
return (x > 0 ? (x + y - 1) / y : x / y);
}
template <typename T, typename U>
T floor(T x, U y) {
return (x > 0 ? x / y : (x - y + 1) / y);
}
template <typename T, typename U>
pair<T, T> divmod(T x, U y) {
T q = floor(x, y);
return {q, x - q * y};
}
ll binary_search(function<bool(ll)> check, ll ok, ll ng) {
assert(check(ok));
while (abs(ok - ng) > 1) {
auto x = (ng + ok) / 2;
if (check(x))
ok = x;
else
ng = x;
}
return ok;
}
template <typename F>
double binary_search_real(F check, double ok, double ng, int iter = 100) {
FOR(iter) {
double x = (ok + ng) / 2;
if (check(x)) {
ok = x;
} else {
ng = x;
}
}
return (ok + ng) / 2;
}
template <class T, class S>
inline bool chmax(T &a, const S &b) {
return (a < b ? a = b, 1 : 0);
}
template <class T, class S>
inline bool chmin(T &a, const S &b) {
return (a > b ? a = b, 1 : 0);
}
vi s_to_vi(const string &S, char first_char) {
vi A(S.size());
FOR(i, S.size()) { A[i] = S[i] - first_char; }
return A;
}
template <typename T>
vector<T> cumsum(vector<T> &A, int off = 1) {
int N = A.size();
vector<T> B(N + 1);
FOR(i, N) { B[i + 1] = B[i] + A[i]; }
if (off == 0) B.erase(B.begin());
return B;
}
template <typename CNT, typename T>
vc<CNT> bincount(const vc<T> &A, int size) {
vc<CNT> C(size);
for (auto &&x: A) { ++C[x]; }
return C;
}
template <typename T>
vector<int> argsort(const vector<T> &A) {
// stable
vector<int> ids(A.size());
iota(all(ids), 0);
sort(all(ids),
[&](int i, int j) { return A[i] < A[j] || (A[i] == A[j] && i < j); });
return ids;
}
// A[I[0]], A[I[1]], ...
template <typename T>
vc<T> rearrange(const vc<T> &A, const vc<int> &I) {
int n = len(A);
assert(len(I) == n);
vc<T> B(n);
FOR(i, n) B[i] = A[I[i]];
return B;
}
#line 1 "library/other/io.hpp"
// based on yosupo's fastio
#include <unistd.h>
namespace detail {
template <typename T, decltype(&T::is_modint) = &T::is_modint>
std::true_type check_value(int);
template <typename T>
std::false_type check_value(long);
} // namespace detail
template <typename T>
struct is_modint : decltype(detail::check_value<T>(0)) {};
template <typename T>
using is_modint_t = enable_if_t<is_modint<T>::value>;
template <typename T>
using is_not_modint_t = enable_if_t<!is_modint<T>::value>;
struct Scanner {
FILE *fp;
char line[(1 << 15) + 1];
size_t st = 0, ed = 0;
void reread() {
memmove(line, line + st, ed - st);
ed -= st;
st = 0;
ed += fread(line + ed, 1, (1 << 15) - ed, fp);
line[ed] = '\0';
}
bool succ() {
while (true) {
if (st == ed) {
reread();
if (st == ed) return false;
}
while (st != ed && isspace(line[st])) st++;
if (st != ed) break;
}
if (ed - st <= 50) {
bool sep = false;
for (size_t i = st; i < ed; i++) {
if (isspace(line[i])) {
sep = true;
break;
}
}
if (!sep) reread();
}
return true;
}
template <class T, enable_if_t<is_same<T, string>::value, int> = 0>
bool read_single(T &ref) {
if (!succ()) return false;
while (true) {
size_t sz = 0;
while (st + sz < ed && !isspace(line[st + sz])) sz++;
ref.append(line + st, sz);
st += sz;
if (!sz || st != ed) break;
reread();
}
return true;
}
template <class T, enable_if_t<is_integral<T>::value, int> = 0>
bool read_single(T &ref) {
if (!succ()) return false;
bool neg = false;
if (line[st] == '-') {
neg = true;
st++;
}
ref = T(0);
while (isdigit(line[st])) { ref = 10 * ref + (line[st++] & 0xf); }
if (neg) ref = -ref;
return true;
}
template <class T, is_modint_t<T> * = nullptr>
bool read_single(T &ref) {
long long val = 0;
bool f = read_single(val);
ref = T(val);
return f;
}
bool read_single(double &ref) {
string s;
if (!read_single(s)) return false;
ref = std::stod(s);
return true;
}
bool read_single(char &ref) {
string s;
if (!read_single(s) || s.size() != 1) return false;
ref = s[0];
return true;
}
template <class T>
bool read_single(vector<T> &ref) {
for (auto &d: ref) {
if (!read_single(d)) return false;
}
return true;
}
template <class T, class U>
bool read_single(pair<T, U> &p) {
return (read_single(p.first) && read_single(p.second));
}
template <class A, class B, class C>
bool read_single(tuple<A, B, C> &p) {
return (read_single(get<0>(p)) && read_single(get<1>(p))
&& read_single(get<2>(p)));
}
template <class A, class B, class C, class D>
bool read_single(tuple<A, B, C, D> &p) {
return (read_single(get<0>(p)) && read_single(get<1>(p))
&& read_single(get<2>(p)) && read_single(get<3>(p)));
}
void read() {}
template <class H, class... T>
void read(H &h, T &... t) {
bool f = read_single(h);
assert(f);
read(t...);
}
Scanner(FILE *fp) : fp(fp) {}
};
struct Printer {
Printer(FILE *_fp) : fp(_fp) {}
~Printer() { flush(); }
static constexpr size_t SIZE = 1 << 15;
FILE *fp;
char line[SIZE], small[50];
size_t pos = 0;
void flush() {
fwrite(line, 1, pos, fp);
pos = 0;
}
void write(const char &val) {
if (pos == SIZE) flush();
line[pos++] = val;
}
template <class T, enable_if_t<is_integral<T>::value, int> = 0>
void write(T val) {
if (pos > (1 << 15) - 50) flush();
if (val == 0) {
write('0');
return;
}
if (val < 0) {
write('-');
val = -val; // todo min
}
size_t len = 0;
while (val) {
small[len++] = char(0x30 | (val % 10));
val /= 10;
}
for (size_t i = 0; i < len; i++) { line[pos + i] = small[len - 1 - i]; }
pos += len;
}
void write(const string &s) {
for (char c: s) write(c);
}
void write(const char *s) {
size_t len = strlen(s);
for (size_t i = 0; i < len; i++) write(s[i]);
}
void write(const double &x) {
ostringstream oss;
oss << setprecision(15) << x;
string s = oss.str();
write(s);
}
void write(const long double &x) {
ostringstream oss;
oss << setprecision(15) << x;
string s = oss.str();
write(s);
}
template <class T, is_modint_t<T> * = nullptr>
void write(T &ref) {
write(ref.val);
}
template <class T>
void write(const vector<T> &val) {
auto n = val.size();
for (size_t i = 0; i < n; i++) {
if (i) write(' ');
write(val[i]);
}
}
template <class T, class U>
void write(const pair<T, U> &val) {
write(val.first);
write(' ');
write(val.second);
}
template <class A, class B, class C>
void write(const tuple<A, B, C> &val) {
auto &[a, b, c] = val;
write(a), write(' '), write(b), write(' '), write(c);
}
template <class A, class B, class C, class D>
void write(const tuple<A, B, C, D> &val) {
auto &[a, b, c, d] = val;
write(a), write(' '), write(b), write(' '), write(c), write(' '), write(d);
}
template <class A, class B, class C, class D, class E>
void write(const tuple<A, B, C, D, E> &val) {
auto &[a, b, c, d, e] = val;
write(a), write(' '), write(b), write(' '), write(c), write(' '), write(d), write(' '), write(e);
}
template <class A, class B, class C, class D, class E, class F>
void write(const tuple<A, B, C, D, E, F> &val) {
auto &[a, b, c, d, e, f] = val;
write(a), write(' '), write(b), write(' '), write(c), write(' '), write(d), write(' '), write(e), write(' '), write(f);
}
template <class T, size_t S>
void write(const array<T, S> &val) {
auto n = val.size();
for (size_t i = 0; i < n; i++) {
if (i) write(' ');
write(val[i]);
}
}
void write(i128 val) {
string s;
bool negative = 0;
if(val < 0){
negative = 1;
val = -val;
}
while (val) {
s += '0' + int(val % 10);
val /= 10;
}
if(negative) s += "-";
reverse(all(s));
if (len(s) == 0) s = "0";
write(s);
}
};
Scanner scanner = Scanner(stdin);
Printer printer = Printer(stdout);
void flush() { printer.flush(); }
void print() { printer.write('\n'); }
template <class Head, class... Tail>
void print(Head &&head, Tail &&... tail) {
printer.write(head);
if (sizeof...(Tail)) printer.write(' ');
print(forward<Tail>(tail)...);
}
void read() {}
template <class Head, class... Tail>
void read(Head &head, Tail &... tail) {
scanner.read(head);
read(tail...);
}
#define INT(...) \
int __VA_ARGS__; \
read(__VA_ARGS__)
#define LL(...) \
ll __VA_ARGS__; \
read(__VA_ARGS__)
#define STR(...) \
string __VA_ARGS__; \
read(__VA_ARGS__)
#define CHAR(...) \
char __VA_ARGS__; \
read(__VA_ARGS__)
#define DBL(...) \
double __VA_ARGS__; \
read(__VA_ARGS__)
#define VEC(type, name, size) \
vector<type> name(size); \
read(name)
#define VV(type, name, h, w) \
vector<vector<type>> name(h, vector<type>(w)); \
read(name)
void YES(bool t = 1) { print(t ? "YES" : "NO"); }
void NO(bool t = 1) { YES(!t); }
void Yes(bool t = 1) { print(t ? "Yes" : "No"); }
void No(bool t = 1) { Yes(!t); }
void yes(bool t = 1) { print(t ? "yes" : "no"); }
void no(bool t = 1) { yes(!t); }
#line 2 "library/string/suffixarray.hpp"
using namespace std;
#define int long long
struct SuffixArray {
vector<int> SA;
vector<int> ISA;
vector<int> LCP;
SuffixArray(string& s) {
char first = 127, last = 0;
for(auto&& c : s){
chmin(first, c);
chmax(last, c);
}
SA = calc_suffix_array(s, first, last);
calc_LCP(s);
}
SuffixArray(vector<int>& s) {
SA = calc_suffix_array(s);
calc_LCP(s);
}
void induced_sort(const std::vector<int>& vect, int val_range,
std::vector<int>& SA, const std::vector<bool>& sl,
const std::vector<int>& lms_idx) {
std::vector<int> l(val_range, 0), r(val_range, 0);
for (int c: vect) {
if (c + 1 < val_range) ++l[c + 1];
++r[c];
}
std::partial_sum(l.begin(), l.end(), l.begin());
std::partial_sum(r.begin(), r.end(), r.begin());
std::fill(SA.begin(), SA.end(), -1);
for (int i = (int)lms_idx.size() - 1; i >= 0; --i)
SA[--r[vect[lms_idx[i]]]] = lms_idx[i];
for (int i: SA)
if (i >= 1 && sl[i - 1]) SA[l[vect[i - 1]]++] = i - 1;
std::fill(r.begin(), r.end(), 0);
for (int c: vect) ++r[c];
std::partial_sum(r.begin(), r.end(), r.begin());
for (int k = (int)SA.size() - 1, i = SA[k]; k >= 1; --k, i = SA[k])
if (i >= 1 && !sl[i - 1]) { SA[--r[vect[i - 1]]] = i - 1; }
}
std::vector<int> SA_IS(const std::vector<int>& vect, int val_range) {
const int n = vect.size();
std::vector<int> SA(n), lms_idx;
std::vector<bool> sl(n);
sl[n - 1] = false;
for (int i = n - 2; i >= 0; --i) {
sl[i] = (vect[i] > vect[i + 1] || (vect[i] == vect[i + 1] && sl[i + 1]));
if (sl[i] && !sl[i + 1]) lms_idx.push_back(i + 1);
}
std::reverse(lms_idx.begin(), lms_idx.end());
induced_sort(vect, val_range, SA, sl, lms_idx);
std::vector<int> new_lms_idx(lms_idx.size()), lms_vec(lms_idx.size());
for (int i = 0, k = 0; i < n; ++i)
if (!sl[SA[i]] && SA[i] >= 1 && sl[SA[i] - 1]) {
new_lms_idx[k++] = SA[i];
}
int cur = 0;
SA[n - 1] = cur;
for (size_t k = 1; k < new_lms_idx.size(); ++k) {
int i = new_lms_idx[k - 1], j = new_lms_idx[k];
if (vect[i] != vect[j]) {
SA[j] = ++cur;
continue;
}
bool flag = false;
for (int a = i + 1, b = j + 1;; ++a, ++b) {
if (vect[a] != vect[b]) {
flag = true;
break;
}
if ((!sl[a] && sl[a - 1]) || (!sl[b] && sl[b - 1])) {
flag = !((!sl[a] && sl[a - 1]) && (!sl[b] && sl[b - 1]));
break;
}
}
SA[j] = (flag ? ++cur : cur);
}
for (size_t i = 0; i < lms_idx.size(); ++i) lms_vec[i] = SA[lms_idx[i]];
if (cur + 1 < (int)lms_idx.size()) {
auto lms_SA = SA_IS(lms_vec, cur + 1);
for (size_t i = 0; i < lms_idx.size(); ++i) {
new_lms_idx[i] = lms_idx[lms_SA[i]];
}
}
induced_sort(vect, val_range, SA, sl, new_lms_idx);
return SA;
}
std::vector<int> calc_suffix_array(const std::string& s,
const char first = 'a',
const char last = 'z') {
std::vector<int> vect(s.size() + 1);
std::copy(std::begin(s), std::end(s), std::begin(vect));
for (auto& x: vect) x -= (int)first - 1;
vect.back() = 0;
auto ret = SA_IS(vect, (int)last - (int)first + 2);
ret.erase(ret.begin());
return ret;
}
std::vector<int> calc_suffix_array(const vector<int>& s) {
vector<int> ss = s;
sort(ss.begin(), ss.end());
ss.erase(unique(ss.begin(), ss.end()), ss.end());
std::vector<int> vect(s.size() + 1);
std::copy(std::begin(s), std::end(s), std::begin(vect));
for (auto& x: vect)
x = lower_bound(ss.begin(), ss.end(), x) - ss.begin() + 1;
vect.back() = 0;
auto ret = SA_IS(vect, *max_element(vect.begin(), vect.end()) + 2);
ret.erase(ret.begin());
return ret;
}
void calc_LCP(const std::string& s) {
int n = s.size(), k = 0;
ISA.resize(n);
LCP.resize(n);
for (int i = 0; i < n; i++) ISA[SA[i]] = i;
for (int i = 0; i < n; i++, k ? k-- : 0) {
if (ISA[i] == n - 1) {
k = 0;
continue;
}
int j = SA[ISA[i] + 1];
while (i + k < n && j + k < n && s[i + k] == s[j + k]) k++;
LCP[ISA[i]] = k;
}
LCP.resize(n - 1);
}
void calc_LCP(const vector<int>& s) {
int n = s.size(), k = 0;
ISA.resize(n);
LCP.resize(n);
for (int i = 0; i < n; i++) ISA[SA[i]] = i;
for (int i = 0; i < n; i++, k ? k-- : 0) {
if (ISA[i] == n - 1) {
k = 0;
continue;
}
int j = SA[ISA[i] + 1];
while (i + k < n && j + k < n && s[i + k] == s[j + k]) k++;
LCP[ISA[i]] = k;
}
LCP.resize(n - 1);
}
};
#line 2 "library/ds/unionfind.hpp"
struct UnionFind {
int n;
int comp;
vc<int> size, par;
UnionFind(int n) : n(n), comp(n), size(n, 1), par(n) {
iota(par.begin(), par.end(), 0);
}
int find(int x) {
assert(0 <= x && x < n);
while (par[x] != x) {
par[x] = par[par[x]];
x = par[x];
}
return x;
}
int operator[](int x) { return find(x); }
bool merge(ll x, ll y) {
x = find(x);
y = find(y);
if (x == y) { return false; }
comp--;
if (size[x] < size[y]) swap(x, y);
size[x] += size[y];
size[y] = 0;
par[y] = x;
return true;
}
vc<int> find_all() {
vc<int> A(n);
FOR(i, n) A[i] = find(i);
return A;
}
void reset(){
comp = n;
size.assign(n, 1);
iota(all(par), 0);
}
};
#line 5 "main.cpp"
void solve() {
LL(N, K);
UnionFind uf(N);
VEC(pi, XY, N);
/*
代表点の番号を K 個管理する
(距離, 2 idx) を set で持つ
*/
vc<int> root(K);
iota(all(root), 0);
auto dist = [&](int i, int j) -> ll {
i = root[i], j = root[j];
auto dx = XY[i].fi - XY[j].fi;
auto dy = XY[i].se - XY[j].se;
return dx * dx + dy * dy;
};
FOR(v, K, N) {
root.eb(v);
ll best = numeric_limits<ll>::max();
pi IJ = {-1, -1};
FOR(j, K + 1) FOR(i, j) {
if (chmin(best, dist(i, j))) IJ = {i, j};
}
auto [i, j] = IJ;
uf.merge(root[i], root[j]);
if (j < K) { swap(root[j], root[K]); }
root.pop_back();
}
vc<int> ANS(N);
FOR(i, N) ANS[i] = uf[i];
auto key = ANS;
UNIQUE(key);
for (auto&& x: ANS) x = LB(key, x) + 1;
print(ANS);
}
signed main() {
cout << fixed << setprecision(15);
LL(T);
FOR(T) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2747ms
memory: 8320kb
input:
100 100000 20 270505 510725 245104 76414 131477 992924 781607 895592 562469 622976 564354 637966 980036 112090 522903 687218 113871 977855 6615 123673 13847 347618 657794 165707 420561 183995 11367 136391 507836 694877 985069 105115 774110 486921 14319 338715 774937 118145 981468 99089 803866 491315...
output:
1 2 3 4 5 5 9 6 3 7 8 12 13 7 6 9 10 8 11 9 10 12 15 4 17 1 13 14 15 5 2 12 16 17 14 4 11 13 4 16 16 8 2 1 5 15 1 18 10 18 15 18 12 15 15 19 7 1 7 15 15 11 19 8 4 13 11 14 17 11 16 12 14 17 7 12 11 10 19 20 4 9 3 10 3 8 13 17 18 10 2 5 5 15 15 4 10 17 9 15 10 1 7 1 7 15 7 13 11 10 17 16 15 17 6 18 5...
result:
ok ac (100 test cases)
Test #2:
score: 0
Accepted
time: 2862ms
memory: 96952kb
input:
5 2000000 20 128546949 27937564 245921588 62819439 245938747 62819439 245920165 62819440 245940996 62819441 245919462 62819441 245943717 62819443 245945427 62819445 245947161 62819447 245947035 62819447 245913847 62819447 245911321 62819450 245910715 62819451 245908052 62819455 245953333 62819457 24...
output:
1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...
result:
ok ac (5 test cases)
Test #3:
score: 0
Accepted
time: 2865ms
memory: 97076kb
input:
5 2000000 20 938915 14534 939099 14534 938896 14534 938968 14534 939120 14534 938967 14534 939092 14534 939047 14534 939083 14534 938959 14534 938980 14534 939094 14534 939096 14534 939158 14534 939129 14534 939050 14534 939146 14534 939067 14534 938953 14534 939118 14534 939174 14534 938957 14534 9...
output:
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
result:
ok ac (5 test cases)
Test #4:
score: 0
Accepted
time: 2970ms
memory: 97024kb
input:
5 1999992 20 714274 363953 4097901 6999896 4285652 7069412 672239 571422 408343 714278 4285652 6512757 995296 428566 4066535 6571329 4285652 6503633 4428508 7305200 1502570 714278 350759 714278 4078994 6999896 4285652 6566018 882958 428566 411620 714278 4085106 6999896 4285652 6530080 4142796 684433...
output:
1 2 3 4 12 5 8 6 5 14 7 12 2 5 8 12 2 5 11 7 14 10 6 14 3 3 10 2 7 9 6 8 10 4 3 10 9 9 3 4 12 7 6 5 11 6 9 4 2 4 12 5 8 9 1 6 5 5 6 4 8 3 4 14 6 11 9 7 9 6 12 7 5 6 14 4 7 10 8 10 13 3 4 13 2 1 6 7 8 5 2 7 12 9 14 5 9 5 12 7 11 7 4 6 10 3 5 2 10 10 12 7 13 9 13 4 6 10 9 8 7 7 5 13 4 11 8 4 13 9 7 13...
result:
ok ac (5 test cases)
Test #5:
score: 0
Accepted
time: 2622ms
memory: 3796kb
input:
98934 43 19 139544 85155 814904 5788 529650 268672 283948 536120 269963 210844 141436 82366 83187 749015 517204 336252 313961 432803 609446 700082 75325 746905 269976 218742 262201 982244 267097 970940 240151 822124 603197 913571 245406 817164 136898 78897 540853 274671 509382 335902 911470 765473 1...
output:
1 2 3 4 5 1 6 11 7 15 6 5 8 8 9 10 9 1 3 11 12 1 10 3 13 11 14 15 16 14 15 10 14 16 5 17 18 12 10 5 19 10 7 1 2 3 4 5 6 7 3 4 7 8 9 10 11 1 12 13 7 13 12 2 6 12 14 11 7 1 15 9 4 12 16 13 5 17 14 12 16 11 18 6 14 16 8 4 11 12 19 9 9 7 18 17 13 19 11 19 12 7 5 15 16 14 9 12 3 17 3 14 18 18 4 12 11 1 1...
result:
ok ac (98934 test cases)
Test #6:
score: 0
Accepted
time: 2642ms
memory: 96932kb
input:
5 2000000 20 797234517 492602938 798908045 502327723 792452167 502906629 798928689 489396948 788980587 490810854 799097890 494409757 802136723 493677251 798645177 497015697 788761604 495701224 794885101 501374539 806251682 495921503 794079841 483699742 797040968 499798682 804797434 501060369 8094369...
output:
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
result:
ok ac (5 test cases)
Test #7:
score: 0
Accepted
time: 160ms
memory: 3612kb
input:
100000 49 3 184136 65720 77810 18746 185003 61402 190816 51862 81874 16192 199764 65637 84958 7413 196301 60803 75931 6532 76068 9903 74087 524 188023 67224 67425 5134 71213 3955 78196 9061 73745 132 84239 12547 69698 611 185262 60938 189186 65907 85093 5693 73581 15566 197267 65267 67120 5883 84736...
output:
1 2 1 1 2 1 2 1 2 2 2 1 2 2 2 2 2 2 1 1 2 2 1 2 2 2 2 2 1 2 2 1 2 2 1 3 1 2 3 2 1 1 2 1 1 2 2 2 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 2 3 3 2 3 3 3 3 3 2 3 3 3 3 1 1 1 2 2 3 3 3 3 1 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 1 1 2 2 1 2 1 1 2 2 2 2 1 2 1 1 2 2 1 2 2 ...
result:
ok ac (100000 test cases)
Extra Test:
score: 0
Extra Test Passed