QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#680923 | #9530. A Game On Tree | ucup-team2796# | AC ✓ | 199ms | 18544kb | C++23 | 13.3kb | 2024-10-26 23:34:25 | 2024-10-26 23:34:26 |
Judging History
answer
#line 1 "library/Template/template.hpp"
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rrep(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)
#define ALL(v) (v).begin(), (v).end()
#define UNIQUE(v) sort(ALL(v)), (v).erase(unique(ALL(v)), (v).end())
#define SZ(v) (int)v.size()
#define MIN(v) *min_element(ALL(v))
#define MAX(v) *max_element(ALL(v))
#define LB(v, x) int(lower_bound(ALL(v), (x)) - (v).begin())
#define UB(v, x) int(upper_bound(ALL(v), (x)) - (v).begin())
using uint = unsigned int;
using ll = long long int;
using ull = unsigned long long;
using i128 = __int128_t;
using u128 = __uint128_t;
const int inf = 0x3fffffff;
const ll INF = 0x1fffffffffffffff;
template <typename T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <typename T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
template <typename T, typename U> T ceil(T x, U y) {
assert(y != 0);
if (y < 0)
x = -x, y = -y;
return (x > 0 ? (x + y - 1) / y : x / y);
}
template <typename T, typename U> T floor(T x, U y) {
assert(y != 0);
if (y < 0)
x = -x, y = -y;
return (x > 0 ? x / y : (x - y + 1) / y);
}
template <typename T> int popcnt(T x) {
return __builtin_popcountll(x);
}
template <typename T> int topbit(T x) {
return (x == 0 ? -1 : 63 - __builtin_clzll(x));
}
template <typename T> int lowbit(T x) {
return (x == 0 ? -1 : __builtin_ctzll(x));
}
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
os << "P(" << p.first << ", " << p.second << ")";
return os;
}
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec) {
os << "{";
for (int i = 0; i < vec.size(); i++) {
os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
}
os << "}";
return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, const map<T, U> &map_var) {
os << "{";
for (auto itr = map_var.begin(); itr != map_var.end(); itr++) {
os << "(" << itr->first << ", " << itr->second << ")";
itr++;
if (itr != map_var.end())
os << ", ";
itr--;
}
os << "}";
return os;
}
template <typename T> ostream &operator<<(ostream &os, const set<T> &set_var) {
os << "{";
for (auto itr = set_var.begin(); itr != set_var.end(); itr++) {
os << *itr;
++itr;
if (itr != set_var.end())
os << ", ";
itr--;
}
os << "}";
return os;
}
#ifdef LOCAL
#define show(...) _show(0, #__VA_ARGS__, __VA_ARGS__)
#else
#define show(...) true
#endif
template <typename T> void _show(int i, T name) {
cerr << '\n';
}
template <typename T1, typename T2, typename... T3>
void _show(int i, const T1 &a, const T2 &b, const T3 &...c) {
for (; a[i] != ',' && a[i] != '\0'; i++)
cerr << a[i];
cerr << ":" << b << " ";
_show(i + 1, a, c...);
}
#line 2 "library/Utility/fastio.hpp"
#include <unistd.h>
namespace fastio {
static constexpr uint32_t SZ = 1 << 17;
char ibuf[SZ];
char obuf[SZ];
char out[100];
// pointer of ibuf, obuf
uint32_t pil = 0, pir = 0, por = 0;
struct Pre {
char num[10000][4];
constexpr Pre() : num() {
for (int i = 0; i < 10000; i++) {
int n = i;
for (int j = 3; j >= 0; j--) {
num[i][j] = n % 10 | '0';
n /= 10;
}
}
}
} constexpr pre;
inline void load() {
memmove(ibuf, ibuf + pil, pir - pil);
pir = pir - pil + fread(ibuf + pir - pil, 1, SZ - pir + pil, stdin);
pil = 0;
if (pir < SZ)
ibuf[pir++] = '\n';
}
inline void flush() {
fwrite(obuf, 1, por, stdout);
por = 0;
}
void rd(char &c) {
do {
if (pil + 1 > pir)
load();
c = ibuf[pil++];
} while (isspace(c));
}
void rd(string &x) {
x.clear();
char c;
do {
if (pil + 1 > pir)
load();
c = ibuf[pil++];
} while (isspace(c));
do {
x += c;
if (pil == pir)
load();
c = ibuf[pil++];
} while (!isspace(c));
}
template <typename T> void rd_real(T &x) {
string s;
rd(s);
x = stod(s);
}
template <typename T> void rd_integer(T &x) {
if (pil + 100 > pir)
load();
char c;
do
c = ibuf[pil++];
while (c < '-');
bool minus = 0;
if constexpr (is_signed<T>::value || is_same_v<T, i128>) {
if (c == '-') {
minus = 1, c = ibuf[pil++];
}
}
x = 0;
while ('0' <= c) {
x = x * 10 + (c & 15), c = ibuf[pil++];
}
if constexpr (is_signed<T>::value || is_same_v<T, i128>) {
if (minus)
x = -x;
}
}
void rd(int &x) {
rd_integer(x);
}
void rd(ll &x) {
rd_integer(x);
}
void rd(i128 &x) {
rd_integer(x);
}
void rd(uint &x) {
rd_integer(x);
}
void rd(ull &x) {
rd_integer(x);
}
void rd(u128 &x) {
rd_integer(x);
}
void rd(double &x) {
rd_real(x);
}
void rd(long double &x) {
rd_real(x);
}
template <class T, class U> void rd(pair<T, U> &p) {
return rd(p.first), rd(p.second);
}
template <size_t N = 0, typename T> void rd_tuple(T &t) {
if constexpr (N < std::tuple_size<T>::value) {
auto &x = std::get<N>(t);
rd(x);
rd_tuple<N + 1>(t);
}
}
template <class... T> void rd(tuple<T...> &tpl) {
rd_tuple(tpl);
}
template <size_t N = 0, typename T> void rd(array<T, N> &x) {
for (auto &d : x)
rd(d);
}
template <class T> void rd(vector<T> &x) {
for (auto &d : x)
rd(d);
}
void read() {}
template <class H, class... T> void read(H &h, T &...t) {
rd(h), read(t...);
}
void wt(const char c) {
if (por == SZ)
flush();
obuf[por++] = c;
}
void wt(const string s) {
for (char c : s)
wt(c);
}
void wt(const char *s) {
size_t len = strlen(s);
for (size_t i = 0; i < len; i++)
wt(s[i]);
}
template <typename T> void wt_integer(T x) {
if (por > SZ - 100)
flush();
if (x < 0) {
obuf[por++] = '-', x = -x;
}
int outi;
for (outi = 96; x >= 10000; outi -= 4) {
memcpy(out + outi, pre.num[x % 10000], 4);
x /= 10000;
}
if (x >= 1000) {
memcpy(obuf + por, pre.num[x], 4);
por += 4;
} else if (x >= 100) {
memcpy(obuf + por, pre.num[x] + 1, 3);
por += 3;
} else if (x >= 10) {
int q = (x * 103) >> 10;
obuf[por] = q | '0';
obuf[por + 1] = (x - q * 10) | '0';
por += 2;
} else
obuf[por++] = x | '0';
memcpy(obuf + por, out + outi + 4, 96 - outi);
por += 96 - outi;
}
template <typename T> void wt_real(T x) {
ostringstream oss;
oss << fixed << setprecision(15) << double(x);
string s = oss.str();
wt(s);
}
void wt(int x) {
wt_integer(x);
}
void wt(ll x) {
wt_integer(x);
}
void wt(i128 x) {
wt_integer(x);
}
void wt(uint x) {
wt_integer(x);
}
void wt(ull x) {
wt_integer(x);
}
void wt(u128 x) {
wt_integer(x);
}
void wt(double x) {
wt_real(x);
}
void wt(long double x) {
wt_real(x);
}
template <class T, class U> void wt(const pair<T, U> val) {
wt(val.first);
wt(' ');
wt(val.second);
}
template <size_t N = 0, typename T> void wt_tuple(const T t) {
if constexpr (N < std::tuple_size<T>::value) {
if constexpr (N > 0) {
wt(' ');
}
const auto x = std::get<N>(t);
wt(x);
wt_tuple<N + 1>(t);
}
}
template <class... T> void wt(tuple<T...> tpl) {
wt_tuple(tpl);
}
template <class T, size_t S> void wt(const array<T, S> val) {
auto n = val.size();
for (size_t i = 0; i < n; i++) {
if (i)
wt(' ');
wt(val[i]);
}
}
template <class T> void wt(const vector<T> val) {
auto n = val.size();
for (size_t i = 0; i < n; i++) {
if (i)
wt(' ');
wt(val[i]);
}
}
void print() {
wt('\n');
}
template <class Head, class... Tail> void print(Head &&head, Tail &&...tail) {
wt(head);
if (sizeof...(Tail))
wt(' ');
print(forward<Tail>(tail)...);
}
void __attribute__((destructor)) _d() {
flush();
}
} // namespace fastio
using fastio::flush;
using fastio::print;
using fastio::read;
inline void first(bool i = true) {
print(i ? "first" : "second");
}
inline void Alice(bool i = true) {
print(i ? "Alice" : "Bob");
}
inline void Takahashi(bool i = true) {
print(i ? "Takahashi" : "Aoki");
}
inline void yes(bool i = true) {
print(i ? "yes" : "no");
}
inline void Yes(bool i = true) {
print(i ? "Yes" : "No");
}
inline void No() {
print("No");
}
inline void YES(bool i = true) {
print(i ? "YES" : "NO");
}
inline void NO() {
print("NO");
}
inline void Yay(bool i = true) {
print(i ? "Yay!" : ":(");
}
inline void Possible(bool i = true) {
print(i ? "Possible" : "Impossible");
}
inline void POSSIBLE(bool i = true) {
print(i ? "POSSIBLE" : "IMPOSSIBLE");
}
/**
* @brief Fast IO
*/
#line 3 "sol.cpp"
#line 2 "library/Math/modint.hpp"
template <unsigned mod = 1000000007> struct fp {
unsigned v;
static constexpr int get_mod() {
return mod;
}
constexpr unsigned inv() const {
assert(v != 0);
int x = v, y = mod, p = 1, q = 0, t = 0, tmp = 0;
while (y > 0) {
t = x / y;
x -= t * y, p -= t * q;
tmp = x, x = y, y = tmp;
tmp = p, p = q, q = tmp;
}
if (p < 0)
p += mod;
return p;
}
constexpr fp(ll x = 0) : v(x >= 0 ? x % mod : (mod - (-x) % mod) % mod) {}
fp operator-() const {
return fp() - *this;
}
fp pow(ull t) {
fp res = 1, b = *this;
while (t) {
if (t & 1)
res *= b;
b *= b;
t >>= 1;
}
return res;
}
fp &operator+=(const fp &x) {
if ((v += x.v) >= mod)
v -= mod;
return *this;
}
fp &operator-=(const fp &x) {
if ((v += mod - x.v) >= mod)
v -= mod;
return *this;
}
fp &operator*=(const fp &x) {
v = ull(v) * x.v % mod;
return *this;
}
fp &operator/=(const fp &x) {
v = ull(v) * x.inv() % mod;
return *this;
}
fp operator+(const fp &x) const {
return fp(*this) += x;
}
fp operator-(const fp &x) const {
return fp(*this) -= x;
}
fp operator*(const fp &x) const {
return fp(*this) *= x;
}
fp operator/(const fp &x) const {
return fp(*this) /= x;
}
bool operator==(const fp &x) const {
return v == x.v;
}
bool operator!=(const fp &x) const {
return v != x.v;
}
friend istream &operator>>(istream &is, fp &x) {
return is >> x.v;
}
friend ostream &operator<<(ostream &os, const fp &x) {
return os << x.v;
}
};
template <unsigned mod> void rd(fp<mod> &x) {
fastio::rd(x.v);
}
template <unsigned mod> void wt(fp<mod> x) {
fastio::wt(x.v);
}
/**
* @brief Modint
*/
#line 5 "sol.cpp"
using Fp = fp<998244353>;
void solve(int _rot) {
// print("Case #"+to_string(_rot)+":");
int n;
read(n);
vector g(n, vector<int>());
rep(_, 0, n - 1) {
int u, v;
read(u, v);
u--, v--;
g[u].push_back(v);
g[v].push_back(u);
}
vector<int> subsz(n);
vector<Fp> sumsz(n);
vector<int> par(n);
auto dfs1 = [&](auto &dfs1, int v, int p) -> void {
subsz[v] = 1;
par[v] = p;
for (auto &to : g[v])
if (to != p) {
dfs1(dfs1, to, v);
subsz[v] += subsz[to];
sumsz[v] += sumsz[to];
}
sumsz[v] += Fp(subsz[v]) * subsz[v];
};
dfs1(dfs1, 0, -1);
Fp ret;
// same,down
rep(v, 0, n) for (auto &u : g[v]) {
if (par[u] == v) {
Fp add = Fp(subsz[u]) * (n - subsz[u]);
ret += add * add;
ret += Fp(sumsz[u] - Fp(subsz[u]) * subsz[u]) * (n - subsz[u]) *
(n - subsz[u]);
}
}
show(ret);
// up
auto dfs2 = [&](auto &dfs2, int v, int p, Fp c) -> void {
Fp sum = 0;
for (auto &to : g[v])
if (to != p) {
sum += sumsz[to];
}
for (auto &to : g[v])
if (to != p) {
Fp nxtc =
c + sum - sumsz[to] + Fp(n - subsz[to]) * (n - subsz[to]);
dfs2(dfs2, to, v, nxtc);
Fp add = (c + sum - sumsz[to]) * subsz[to] * subsz[to];
ret += add;
}
};
dfs2(dfs2, 0, -1, 0);
Fp x = Fp(n) * (n - 1) / 2;
ret /= x * x;
print(ret);
}
int main() {
int t;
read(t);
rep(rot, 0, t) solve(rot + 1);
return 0;
}
这程序好像有点Bug,我给组数据试试?
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3924kb
input:
2 3 1 2 2 3 5 1 2 1 5 3 2 4 2
output:
443664158 918384806
result:
ok 2 lines
Test #2:
score: 0
Accepted
time: 1ms
memory: 3708kb
input:
1000 7 3 6 4 3 5 3 2 6 1 4 7 1 12 5 7 10 7 2 10 11 2 1 7 8 1 4 2 9 11 6 9 12 11 3 5 6 2 5 1 2 4 5 6 4 3 6 5 2 5 1 5 4 5 3 2 8 1 8 2 8 4 2 6 1 5 6 7 6 3 8 8 3 8 7 3 4 8 6 4 2 7 5 2 1 4 4 3 1 4 3 2 1 6 5 1 6 1 2 5 3 5 4 2 12 8 11 5 11 12 8 3 12 6 12 2 3 4 6 10 11 1 5 9 5 7 5 9 6 1 7 6 4 7 8 7 5 4 9 6 ...
output:
948445317 468414020 550143557 918384806 711758412 487662742 776412276 869581749 240852807 765628773 211048577 887328316 890334966 940494682 760637552 908032643 592850815 584006902 908525604 221832080 433351719 56023919 867301808 183319566 698771049 366957926 449579681 599710576 310564911 286902823 3...
result:
ok 1000 lines
Test #3:
score: 0
Accepted
time: 13ms
memory: 3868kb
input:
1000 94 59 1 33 59 73 1 6 33 83 59 4 59 20 59 61 6 39 1 76 73 71 6 44 39 9 71 24 4 87 9 57 83 2 9 81 71 82 20 90 2 85 39 12 9 30 83 66 30 53 9 47 9 36 44 43 53 29 12 31 53 64 81 38 31 84 82 77 38 23 71 93 84 78 83 58 31 68 90 42 1 55 64 13 78 70 78 62 24 19 55 92 87 14 57 10 84 65 81 63 6 75 36 91 1...
output:
508107725 996793960 201633249 335988372 842755864 460619380 342223697 207523414 429241811 391691799 542977964 786416604 454278948 685531402 25914978 440729774 228518323 679471537 82764520 554190841 432505337 143444089 189106586 337234245 61954935 905141094 532919674 703954588 185671863 942858630 692...
result:
ok 1000 lines
Test #4:
score: 0
Accepted
time: 192ms
memory: 18196kb
input:
10000 8 1 4 3 1 5 1 7 3 8 4 6 8 2 7 8 2 6 4 6 5 6 8 5 7 6 3 5 1 7 8 8 5 6 5 2 5 7 2 1 6 3 1 4 8 9 8 6 9 8 3 6 1 8 5 9 2 8 4 3 7 9 8 8 6 3 6 5 8 1 6 4 3 7 6 2 6 9 9 5 7 5 2 7 8 7 4 9 3 7 6 3 1 4 8 1 4 5 1 6 5 3 4 8 4 7 8 2 5 9 1 8 6 1 2 1 3 8 5 3 9 8 7 8 4 8 9 4 9 2 9 1 2 3 4 5 2 6 9 8 3 7 2 8 1 2 8 ...
output:
49657566 56023919 387074343 97051536 701572244 211048577 711758412 308100110 761007271 711758412 178698065 285212675 80216065 43380497 267677376 818005792 53239701 765628773 970145625 387074343 436731906 422725927 479157293 977872021 436731906 925779210 487662742 705549251 267677376 711758412 526851...
result:
ok 10000 lines
Test #5:
score: 0
Accepted
time: 184ms
memory: 18164kb
input:
10000 8 7 6 8 6 5 7 4 6 1 4 2 5 3 5 10 10 7 8 7 9 8 2 8 6 7 1 7 5 9 4 1 3 6 10 2 6 3 6 5 6 7 2 1 3 4 5 8 5 9 5 10 4 10 6 5 2 5 4 6 8 5 10 5 9 5 1 8 3 6 7 1 8 5 2 3 5 6 5 1 2 8 2 4 1 7 5 9 5 1 3 1 7 5 9 7 6 3 8 6 2 1 4 9 9 9 8 4 8 3 8 6 9 2 8 7 6 1 2 5 6 9 2 5 8 5 7 8 9 7 1 8 4 8 6 9 3 1 8 6 7 8 6 2 ...
output:
711758412 286902823 691130166 841483019 650641410 887328317 331207619 733278261 56023919 977872021 414394648 183319566 239374924 696059768 855285904 761007271 711758412 86268032 599710576 728310932 178698065 178698065 422725927 219002589 178698065 202450068 599710576 56023919 449579681 760637552 925...
result:
ok 10000 lines
Test #6:
score: 0
Accepted
time: 199ms
memory: 18396kb
input:
10000 9 8 1 2 8 4 1 3 2 7 1 6 7 9 3 5 1 9 7 5 1 7 3 7 9 5 2 3 8 1 6 8 4 6 9 7 8 4 7 5 4 3 4 6 8 1 3 9 8 2 7 9 8 7 2 8 9 8 5 8 1 2 3 7 6 3 4 7 8 6 8 4 6 2 4 5 8 7 5 1 6 3 7 9 9 8 7 8 2 9 5 9 1 5 3 1 6 2 4 8 10 2 10 4 10 6 4 1 10 9 6 8 9 5 10 7 4 3 2 10 3 9 5 3 4 3 7 9 6 3 10 6 2 9 8 5 1 2 10 8 5 2 8 ...
output:
211048577 354315128 178698065 705549251 285212675 138645051 449579681 286902823 925779210 294297225 519087065 368179632 422725927 603876215 539175192 867301808 977540027 669439919 211048577 701572244 977872021 138645051 267677376 855285904 977872021 286902823 925286249 705549251 219002589 331207619 ...
result:
ok 10000 lines
Test #7:
score: 0
Accepted
time: 196ms
memory: 16992kb
input:
10000 8 4 2 6 2 1 6 5 1 3 1 7 5 8 5 8 4 3 8 4 6 8 2 3 5 8 1 4 7 5 9 6 1 8 6 7 8 5 6 4 1 9 6 3 1 2 5 8 3 2 5 2 7 2 8 2 1 7 4 3 6 8 10 10 2 7 10 3 7 8 7 5 10 1 5 4 3 6 4 9 7 8 5 4 8 4 2 5 7 4 6 8 1 7 3 1 9 3 1 8 1 5 1 6 5 2 6 9 5 7 5 4 2 10 1 3 6 1 2 3 7 3 8 7 9 1 10 7 5 7 4 10 10 3 2 10 3 5 10 9 3 1 ...
output:
422725927 977872021 867301808 407446676 466833287 387074343 97051536 292325385 301691628 765628773 285212675 711758412 650641410 178698065 543242114 286902823 473241769 109930120 841975980 836553418 422725927 286902823 414394648 739440264 436731906 56023919 436731906 530918109 603876215 977872021 40...
result:
ok 10000 lines
Test #8:
score: 0
Accepted
time: 187ms
memory: 18544kb
input:
10000 9 9 3 7 9 2 3 5 2 6 2 1 9 4 5 8 9 10 4 6 9 4 8 6 5 4 10 5 7 8 2 8 3 7 1 2 10 5 4 1 4 3 4 9 3 6 3 7 9 8 7 2 4 10 7 10 3 8 4 3 10 8 6 10 9 4 5 6 2 8 1 2 7 5 10 10 9 4 9 6 10 5 10 2 6 1 10 3 1 8 3 7 10 10 9 7 10 7 2 7 3 10 1 3 4 3 8 9 6 3 5 6 9 2 4 7 4 5 7 9 5 3 5 6 7 8 7 1 2 9 2 4 1 4 9 2 7 2 8 ...
output:
409773147 306621231 836553418 760637552 519087065 304649390 97051536 742521264 387074343 855285904 874737082 358875008 733278261 698524570 908525604 387074343 970145625 449579681 286902823 239374924 650641410 691130166 765628773 603876215 839572800 977872021 742521264 908032643 874737082 299719788 7...
result:
ok 10000 lines
Test #9:
score: 0
Accepted
time: 181ms
memory: 17888kb
input:
10000 9 8 4 5 4 6 4 3 5 7 4 9 6 1 9 2 9 10 3 9 10 3 2 10 6 2 1 6 8 2 4 1 5 3 7 9 9 9 3 7 9 4 3 5 3 2 3 6 5 1 6 8 9 8 6 1 8 1 5 6 7 6 4 8 3 6 2 7 8 2 3 7 2 8 2 6 8 5 2 1 3 4 2 10 2 7 8 7 9 2 5 8 10 8 3 7 1 7 4 8 6 7 9 3 8 4 3 5 3 2 8 9 2 1 5 6 8 7 4 9 5 1 6 5 4 6 9 6 3 4 2 9 8 1 7 4 8 2 4 8 4 3 2 5 3...
output:
331207619 28098733 97051536 599710576 701572244 277043619 368179632 138645051 711758412 626059423 86268032 414394648 368179632 993314752 321410036 530918109 711758412 712327454 603876215 49657566 705549251 765628773 56023919 299719788 887328316 839572800 650641410 211048577 286902823 908032643 28690...
result:
ok 10000 lines
Test #10:
score: 0
Accepted
time: 191ms
memory: 17044kb
input:
10000 10 4 9 7 4 2 4 5 4 6 7 10 2 3 9 8 10 1 8 8 2 4 3 2 5 2 6 4 1 4 8 3 7 1 8 8 7 6 7 4 8 5 4 1 6 2 5 3 4 8 7 2 3 2 5 3 1 5 8 1 4 7 6 2 9 5 9 6 9 4 6 7 9 8 4 3 6 1 6 2 5 10 7 1 4 7 2 7 5 2 8 5 3 2 6 7 10 4 9 2 8 6 2 3 6 7 2 8 3 5 6 4 5 1 2 10 2 8 5 8 10 8 4 10 7 8 3 2 1 10 6 4 9 10 10 3 5 6 5 10 5 ...
output:
440213438 977872021 285212675 285212675 705549251 267677376 436731906 267677376 440213438 712327454 711758412 191268549 321410036 436731906 839572800 49657566 519087065 178698065 977872021 285212675 574298605 368179632 466833287 696059768 86268033 308100110 487662742 887328317 977872021 701572244 99...
result:
ok 10000 lines
Test #11:
score: 0
Accepted
time: 191ms
memory: 17004kb
input:
10000 8 1 3 8 3 2 3 6 8 5 8 4 1 7 1 10 5 7 10 7 2 5 4 5 8 10 6 7 1 5 3 2 9 8 9 4 7 2 4 1 4 5 4 9 1 3 2 6 4 8 9 8 5 7 3 5 2 5 6 5 4 7 8 3 1 7 9 1 5 9 5 3 1 7 3 8 3 6 3 4 1 2 8 8 1 2 4 2 6 2 7 2 8 7 3 8 5 6 9 4 5 3 4 6 4 7 3 1 5 9 3 2 1 8 7 9 1 6 3 1 2 3 5 2 4 3 8 5 9 5 7 1 8 5 3 7 3 4 3 8 7 1 3 6 1 2...
output:
202450068 449579681 742521264 56023919 705549251 599710576 765628773 887328316 599710576 97051536 286902823 603876215 321410036 221832080 294297225 479157293 650641410 765628773 908525604 285212675 125704848 414394648 599254713 286902823 707938599 13864507 599710576 304649390 691130166 56023919 7656...
result:
ok 10000 lines
Test #12:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
1 2 1 2
output:
1
result:
ok single line: '1'
Extra Test:
score: 0
Extra Test Passed