QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#96969 | #6324. Expanded Hull | applese | AC ✓ | 153ms | 3996kb | C++14 | 9.8kb | 2023-04-16 12:30:26 | 2023-04-16 12:30:29 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define double long double
const double eps = 1e-12;
int Dcmp(double x) {
return x < -eps ? -1 : x > eps ? 1 : 0;
}
struct Point {
double x, y, z;
Point(double x = 0, double y = 0, double z = 0) : x(x), y(y), z(z) {}
bool operator == (const Point &rhs) const {
return Dcmp(x - rhs.x) == 0 && Dcmp(y - rhs.y) == 0 && Dcmp(z - rhs.z) == 0;
}
Point operator + (const Point &rhs) const {
return Point(x + rhs.x, y + rhs.y, z + rhs.z);
}
Point operator - (const Point &rhs) const {
return Point(x - rhs.x, y - rhs.y, z - rhs.z);
}
double operator * (const Point &rhs) const {
return x * rhs.x + y * rhs.y + z * rhs.z;
}
Point operator ^ (const Point &rhs) const {
return Point(y * rhs.z - z * rhs.y, z * rhs.x - x * rhs.z, x * rhs.y - y * rhs.x);
}
Point operator * (const double &k) const {
return Point(x * k, y * k, z * k);
}
Point operator / (const double &k) const {
return Point(x / k, y / k, z / k);
}
double len2() {
return x * x + y * y + z * z;
}
double len() {
return sqrt(len2());
}
Point Unit() {
return *this / len();
}
};
int Cmp(Point a, Point b) {
return Dcmp(a.z - b.z) == 0 ? Dcmp(a.x - b.x) == 0 ? Dcmp(a.y - b.y) < 0 : Dcmp(a.x - b.x) < 0 : Dcmp(a.z - b.z) < 0;
}
double Volume(Point a, Point b, Point c, Point d) {
return ((b - a) ^ (c - a)) * (d - a);
}
struct Line {
Point s, t;
Line(Point s = Point(), Point t = Point()) : s(s), t(t) {}
};
vector<Line> vl;
namespace Hull {
const int maxn = 205;
struct Face {
int a, b, c, ok;
};
int n;
Point P[maxn];
int num;
Face F[8 * maxn];
int g[maxn][maxn];
double Dblcmp(Point p, Face f) {
Point p1 = P[f.b] - P[f.a], p2 = P[f.c] - P[f.a], p3 = p - P[f.a];
return (p1 ^ p2) * p3;
}
void Dfs(int p, int now);
void Deal(int p, int a, int b) {
int f = g[a][b];
Face add;
if(F[f].ok) {
if(Dblcmp(P[p], F[f]) > eps) {
Dfs(p, f);
}
else {
add.a = b, add.b = a, add.c = p, add.ok = 1, g[p][b] = g[a][p] = g[b][a] = num, F[num ++] = add;
}
}
}
void Dfs(int p, int now) {
F[now].ok = false;
Deal(p, F[now].b, F[now].a);
Deal(p, F[now].c, F[now].b);
Deal(p, F[now].a, F[now].c);
}
bool Same(int s, int t) {
Point &a = P[F[s].a], &b = P[F[s].b], &c = P[F[s].c];
return Dcmp(Volume(a, b, c, P[F[t].a])) == 0 && Dcmp(Volume(a, b, c, P[F[t].b])) == 0 && Dcmp(Volume(a, b, c, P[F[t].c])) == 0;
}
void Create() {
num = 0;
Face add;
int flag = 1;
for(int i = 1; i < n; ++ i) {
if(!(P[0] == P[i])) {
swap(P[1], P[i]);
flag = 0;
break;
}
}
if(flag)
return;
flag = 1;
for(int i = 2; i < n; ++ i) {
if(Dcmp(((P[1] - P[0]) ^ (P[i] - P[0])).len()) == 1) {
swap(P[2], P[i]);
flag = 0;
break;
}
}
if(flag)
return;
flag = 1;
for(int i = 3; i < n; ++ i) {
if(Dcmp(Volume(P[0], P[1], P[2], P[i]))) {
swap(P[3], P[i]);
flag = 0;
break;
}
}
if(flag)
return;
for(int i = 0; i < 4; ++ i) {
add.a = (i + 1) % 4;
add.b = (i + 2) % 4;
add.c = (i + 3) % 4;
add.ok = 1;
if(Dblcmp(P[i], add) > 0)
swap(add.b, add.c);
g[add.a][add.b] = g[add.b][add.c] = g[add.c][add.a] = num;
F[num ++] = add;
}
for(int i = 4; i < n; ++ i) {
for(int j = 0; j < num; ++ j) {
if(F[j].ok && Dblcmp(P[i], F[j]) > eps) {
Dfs(i, j);
break;
}
}
}
int tmp = num;
num = 0;
for(int i = 0; i < tmp; ++ i)
if(F[i].ok)
F[num ++] = F[i];
}
int vis[maxn][maxn];
void Extract() {
for(int i = 0; i < num; ++ i) {
int p = F[i].a, q = F[i].b;
if(Cmp(P[q], P[p]))
swap(p, q);
if(!vis[p][q])
vis[p][q] = 1, vl.push_back(Line(P[p], P[q]));
p = F[i].b, q = F[i].c;
if(Cmp(P[q], P[p]))
swap(p, q);
if(!vis[p][q])
vis[p][q] = 1, vl.push_back(Line(P[p], P[q]));
p = F[i].a, q = F[i].c;
if(Cmp(P[q], P[p]))
swap(p, q);
if(!vis[p][q])
vis[p][q] = 1, vl.push_back(Line(P[p], P[q]));
}
}
}
int n;
long long k, ans[5];
const int maxn = 2005, lim = 200;
vector<int> add[maxn], del[maxn];
vector<Line> nowl;
set<int> s;
struct P2 {
double x, y;
P2(double x = 0, double y = 0) : x(x), y(y) {}
bool operator == (const P2 &rhs) const {
return Dcmp(x - rhs.x) == 0 && Dcmp(y - rhs.y) == 0;
}
bool operator < (const P2 &rhs) const {
return Dcmp(x - rhs.x) == 0 ? Dcmp(y - rhs.y) < 0 : Dcmp(x - rhs.x) < 0;
}
P2 operator + (const P2 &rhs) const {
return P2(x + rhs.x, y + rhs.y);
}
P2 operator - (const P2 &rhs) const {
return P2(x - rhs.x, y - rhs.y);
}
double operator ^ (const P2 &rhs) const {
return x * rhs.y - y * rhs.x;
}
P2 operator * (const double &k) const {
return P2(x * k, y * k);
}
P2 operator / (const double &k) const {
return P2(x / k, y / k);
}
double len2() {
return x * x + y * y;
}
};
int Left(const P2 &a, const P2 &b, const P2 &c) {
return Dcmp((b - a) ^ (c - a)) >= 0;
}
P2 base;
vector<P2> Convex(vector<P2>a) {
int n = a.size(), cnt = 0;
if(n < 3)
return a;
base = a[0];
for(auto p : a)
if(make_pair(p.x, p.y) < make_pair(base.x, base.y))
base = p;
sort(a.begin(), a.end(), [](const P2 &a, const P2 &b) {
int d = Dcmp((a - base) ^ (b - base));
if(d)
return d > 0;
return (a - base).len2() < (b - base).len2();
});
vector<P2>res;
for(int i = 0; i < n; ++ i) {
while(cnt > 1 && Left(res[cnt - 2], a[i], res[cnt - 1]))
-- cnt, res.pop_back();
res.push_back(a[i]), ++ cnt;
}
return res;
}
long long Calc(int mul) {
int nowlim = lim * mul;
for(int i = 0; i <= 2 * nowlim; ++ i)
add[i].clear(), del[i].clear();
nowl.resize(vl.size());
// cerr << vl.size() << endl;
for(int i = 0; i < (int)vl.size(); ++ i) {
nowl[i] = Line(vl[i].s * mul, vl[i].t * mul);
// cerr << "L: " << endl;
// cerr << nowl[i].s.x << " " << nowl[i].s.y << " " << nowl[i].s.z << endl;
// cerr << nowl[i].t.x << " " << nowl[i].t.y << " " << nowl[i].t.z << endl;
add[int(ceil(nowl[i].s.z)) + nowlim].push_back(i);
del[int(floor(nowl[i].t.z)) + nowlim].push_back(i);
}
long long ans = 0;
for(int i = 0; i <= 2 * nowlim; ++ i) {
for(auto j : add[i])
s.insert(j);
vector<P2> v;
v.clear();
int z = i - nowlim;
for(auto x : s) {
int f = 0;
if(Dcmp(nowl[x].s.z - z) == 0)
v.push_back(P2(nowl[x].s.x, nowl[x].s.y)), f = 1;
if(Dcmp(nowl[x].t.z - z) == 0)
v.push_back(P2(nowl[x].t.x, nowl[x].t.y)), f = 1;
if(!f) {
assert(Dcmp(nowl[x].s.z - z) < 0 && Dcmp(nowl[x].t.z - z) > 0);
Point p = nowl[x].s + (nowl[x].t - nowl[x].s) / (nowl[x].t.z - nowl[x].s.z) * (z - nowl[x].s.z);
v.push_back(P2(p.x, p.y));
}
}
if(!v.size())
continue;
sort(v.begin(), v.end());
v.erase(unique(v.begin(), v.end()), v.end());
v = Convex(v);
// cerr << "At z = " << z << ": Convex is ";
// for(auto p : v)
// cerr << "(" << p.x << ", " << p.y << ")" << endl;
// cerr << endl;
int pos = 0, sz = v.size();
for(int j = 1; j < sz; ++ j)
if(v[pos] < v[j])
pos = j;
#define Pre(p) ((p + sz - 1) % sz)
#define Nxt(p) ((p + 1) % sz)
int upp = 0, dwp = 0;
for(int x = -nowlim; x <= nowlim; ++ x) {
while(upp != pos && Dcmp(v[Pre(upp)].x - x) <= 0)
upp = Pre(upp);
while(dwp != pos && Dcmp(v[Nxt(dwp)].x - x) <= 0)
dwp = Nxt(dwp);
int mx = -nowlim - 1, mn = nowlim + 1;
if(Dcmp(v[upp].x - x) <= 0) {
if(upp != pos) {
P2 s = v[upp], t = v[Pre(upp)], w = s + (t - s) / (t.x - s.x) * (x - s.x);
if(Dcmp(w.y - round(w.y)) == 0)
mx = round(w.y);
else
mx = floor(w.y);
}
else if(Dcmp(v[upp].x - x) == 0) {
double wy = v[upp].y;
if(Dcmp(wy - round(wy)) == 0)
mx = round(wy);
else
mx = floor(wy);
}
}
if(Dcmp(v[dwp].x - x) <= 0) {
if(dwp != pos) {
P2 s = v[dwp], t = v[Nxt(dwp)], w = s + (t - s) / (t.x - s.x) * (x - s.x);
if(Dcmp(w.y - round(w.y)) == 0)
mn = round(w.y);
else
mn = ceil(w.y);
}
else if(Dcmp(v[dwp].x - x) == 0) {
if(v.size() > 2u) {
while(Dcmp(v[dwp].x - x) == 0)
dwp = Pre(dwp);
dwp = Nxt(dwp);
}
else if(v.size() == 2u && Dcmp(v[Pre(dwp)].x - x) == 0)
dwp = Pre(dwp);
double wy = v[dwp].y;
if(Dcmp(wy - round(wy)) == 0)
mn = round(wy);
else
mn = ceil(wy);
}
}
if(mn <= mx) {
// cerr << "At x = " << x << ": mn = " << mn << " mx = " << mx << endl;
ans += max(0, mx - mn + 1);
// cerr << ans << endl;
}
}
#undef Pre
#undef Nxt
// cerr << ans << endl;
for(auto j : del[i])
s.erase(s.find(j));
}
// cerr << "Multiply " << mul << ": ans = " << ans << endl;
return ans;
}
const int mod = 998244353;
int Add(int x, int y) {
return (x += y) >= mod ? x - mod : x;
}
int Sub(int x, int y) {
return (x -= y) < 0 ? x + mod : x;
}
int Mul(int x, int y) {
return 1ll * x * y % mod;
}
int Pow(int x, int y) {
int res = 1;
for(; y; x = Mul(x, x), y >>= 1)
if(y & 1)
res = Mul(res, x);
return res;
}
int main() {
scanf("%d%lld", &n, &k);
for(int i = 0, x, y, z; i < n; ++ i) {
scanf("%d%d%d", &x, &y, &z);
Hull :: P[i] = Point(x, y, z);
}
Hull :: n = n;
Hull :: Create();
// cerr << Hull :: num << endl;
Hull :: Extract();
// for(auto l : vl)
// cerr << "(" << l.s.x << ", " << l.s.y << ", " << l.s.z << ") (" << l.t.x << ", " << l.t.y << ", " << l.t.z << ")" << endl;
ans[0] = 1;
// Calc(1);
for(int i = 1; i <= 3; ++ i)
ans[i] = Calc(i);
if(k <= 3)
printf("%lld\n", ans[k]);
else {
int ret = 0;
for(int i = 0; i <= 3; ++ i) {
int up = ans[i] % mod, dn = 1;
for(int j = 0; j <= 3; ++ j) {
if(i == j)
continue;
up = Mul(up, Sub(k % mod, j));
dn = Mul(dn, Sub(i, j));
}
ret = Add(ret, Mul(up, Pow(dn, mod - 2)));
}
printf("%d\n", ret);
}
}
详细
Test #1:
score: 100
Accepted
time: 2ms
memory: 3712kb
input:
4 2 0 0 0 1 0 0 0 1 0 0 0 1
output:
10
result:
ok 1 number(s): "10"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3688kb
input:
4 10000 0 0 0 1 0 0 0 1 0 0 0 1
output:
59878050
result:
ok 1 number(s): "59878050"
Test #3:
score: 0
Accepted
time: 3ms
memory: 3760kb
input:
8 314159265358979 5 -3 -3 -5 -3 -3 0 5 -3 0 0 10 4 2 6 -4 2 6 0 -5 6 0 0 -5
output:
152811018
result:
ok 1 number(s): "152811018"
Test #4:
score: 0
Accepted
time: 84ms
memory: 3780kb
input:
100 1 0 0 77 0 0 -195 0 0 -194 0 0 -112 0 0 -192 0 0 62 0 0 73 0 0 188 0 0 -150 0 0 -26 0 0 -164 0 0 -142 0 0 -90 200 1 0 0 0 50 0 0 111 0 0 -133 0 0 91 0 0 -70 0 0 46 0 0 175 -200 -67 0 0 0 128 0 0 170 0 0 76 0 0 -28 0 0 47 0 0 -196 0 0 45 0 0 -136 0 0 96 0 0 24 0 0 -29 0 0 -141 0 0 -84 0 0 -99 0 0...
output:
882531
result:
ok 1 number(s): "882531"
Test #5:
score: 0
Accepted
time: 84ms
memory: 3772kb
input:
82 333333333 98 99 168 -106 -105 -172 113 114 193 -13 -12 -17 -115 -114 -187 71 72 123 -70 -69 -112 95 96 163 -85 -84 -137 -28 -27 -42 -31 -30 -47 -200 -67 0 -121 -120 -197 -52 -51 -82 -112 -111 -182 110 111 188 44 45 78 86 87 148 104 105 178 -73 -72 -117 47 48 83 62 63 108 -103 -102 -167 56 57 98 1...
output:
767480931
result:
ok 1 number(s): "767480931"
Test #6:
score: 0
Accepted
time: 90ms
memory: 3868kb
input:
100 1 -63 -39 51 -36 -104 70 9 -77 34 115 -153 19 -161 141 10 157 -149 -4 -82 -92 87 14 114 -64 -176 -68 122 -7 -179 93 -182 200 -9 173 97 -135 0 -1 200 -83 -189 136 117 69 -93 -3 -113 58 183 -179 -2 -52 -184 118 -107 89 9 -24 -48 36 -111 87 12 -143 -173 158 -176 -78 127 -96 162 -33 147 -111 -18 -92...
output:
9771107
result:
ok 1 number(s): "9771107"
Test #7:
score: 0
Accepted
time: 118ms
memory: 3884kb
input:
100 1159111449 82 82 90 181 181 -85 70 70 -20 1 1 0 190 190 56 -83 -83 40 -89 -89 39 136 136 146 -195 -195 47 50 50 -99 -101 -101 -161 162 162 146 23 23 152 181 181 -91 -73 -73 -5 -105 -105 6 155 155 -136 152 152 -190 -33 -33 -137 55 55 41 3 3 -199 -168 -168 -177 -111 -111 115 171 171 8 131 131 123 ...
output:
681451260
result:
ok 1 number(s): "681451260"
Test #8:
score: 0
Accepted
time: 107ms
memory: 3764kb
input:
8 1 200 200 200 -200 -200 -200 200 -200 -200 -200 200 200 -200 200 -200 200 200 -200 200 -200 200 -200 -200 200
output:
64481201
result:
ok 1 number(s): "64481201"
Test #9:
score: 0
Accepted
time: 103ms
memory: 3696kb
input:
8 10 200 200 200 -200 200 200 -200 -200 200 200 200 -200 -200 -200 -200 200 -200 -200 -200 200 -200 200 -200 200
output:
160373409
result:
ok 1 number(s): "160373409"
Test #10:
score: 0
Accepted
time: 108ms
memory: 3664kb
input:
8 1234567890123 -200 -200 200 -200 200 200 -200 200 -200 -200 -200 -200 200 -200 200 200 -200 -200 200 200 200 200 200 -200
output:
868669244
result:
ok 1 number(s): "868669244"
Test #11:
score: 0
Accepted
time: 110ms
memory: 3784kb
input:
24 1 200 200 140 200 -140 200 140 200 -200 -140 -200 200 -200 200 140 -200 200 -140 -200 140 200 200 140 -200 200 -140 -200 200 200 -140 -200 -200 140 -200 -140 -200 -200 -200 -140 -200 140 -200 -140 200 200 140 -200 200 200 -200 -140 -200 -140 200 200 140 200 200 -200 140 140 -200 -200 140 200 200 ...
output:
64178641
result:
ok 1 number(s): "64178641"
Test #12:
score: 0
Accepted
time: 108ms
memory: 3844kb
input:
24 10 -200 140 -200 200 -140 200 200 140 200 -200 -140 -200 140 -200 -200 200 200 140 -200 -200 -140 -200 200 140 200 -140 -200 -200 -200 140 -140 200 -200 140 -200 200 200 -200 -140 -200 -140 200 -140 -200 -200 -200 200 -140 200 -200 140 200 200 -140 140 200 -200 -140 200 200 -140 -200 200 200 140 ...
output:
869176162
result:
ok 1 number(s): "869176162"
Test #13:
score: 0
Accepted
time: 104ms
memory: 3808kb
input:
24 1234567890123 -200 -140 -200 140 -200 -200 140 200 -200 200 -140 200 -200 -140 200 200 140 200 -140 200 -200 -200 -200 -140 200 200 140 -200 140 -200 -140 200 200 -140 -200 -200 200 -200 140 -200 -200 140 200 -140 -200 140 -200 200 200 140 -200 200 200 -140 200 -200 -140 -140 -200 200 -200 140 20...
output:
908630290
result:
ok 1 number(s): "908630290"
Test #14:
score: 0
Accepted
time: 122ms
memory: 3980kb
input:
100 1 11 200 0 -197 36 0 -199 17 0 -76 -185 0 136 -147 0 -194 -50 0 140 143 0 0 0 -200 -5 200 0 -180 -88 0 -21 199 0 -99 -174 0 -186 74 0 116 -163 0 153 128 0 118 -161 0 -68 188 0 -200 -1 0 -194 47 0 -196 -40 0 -185 76 0 196 41 0 146 137 0 99 174 0 -124 -157 0 121 -159 0 -200 9 0 -59 191 0 -83 182 0...
output:
16722291
result:
ok 1 number(s): "16722291"
Test #15:
score: 0
Accepted
time: 120ms
memory: 3972kb
input:
100 3 -87 180 0 -163 116 0 -185 -76 0 -200 0 0 200 13 0 189 66 0 -128 -153 0 -192 57 0 44 195 0 167 110 0 -116 -163 0 47 194 0 -86 -181 0 92 -178 0 -53 -193 0 66 189 0 -92 -178 0 -176 96 0 191 -60 0 197 32 0 -78 -184 0 -14 -200 0 -179 -89 0 109 168 0 177 -94 0 176 -95 0 94 -176 0 70 187 0 128 153 0 ...
output:
450766066
result:
ok 1 number(s): "450766066"
Test #16:
score: 0
Accepted
time: 123ms
memory: 3940kb
input:
100 784433716 -103 172 0 -154 128 0 129 -153 0 84 -181 0 -7 200 0 138 -145 0 -97 -175 0 196 -38 0 -148 -135 0 -197 -37 0 141 142 0 128 -154 0 -164 114 0 106 -169 0 -151 131 0 -122 -158 0 170 105 0 61 -191 0 -192 -58 0 197 -33 0 -170 -105 0 109 -167 0 -181 85 0 166 111 0 -44 -195 0 0 0 -200 49 -194 0...
output:
631042395
result:
ok 1 number(s): "631042395"
Test #17:
score: 0
Accepted
time: 94ms
memory: 3720kb
input:
20 1 94 -145 -152 38 -114 138 186 -113 -75 154 -91 -178 191 173 -24 174 23 -128 126 -60 -17 -5 182 -3 -20 -71 157 197 51 68 41 117 -190 184 32 -152 21 -112 158 -14 110 172 24 -9 31 -13 -93 -192 -108 104 179 17 86 -76 107 -72 53 99 -19 60
output:
16547736
result:
ok 1 number(s): "16547736"
Test #18:
score: 0
Accepted
time: 147ms
memory: 3888kb
input:
93 1 -64 -152 107 92 128 -174 170 56 177 137 -113 -41 -37 -24 -185 185 162 -187 182 35 79 -71 73 -114 126 -117 -44 -160 121 103 -98 163 59 141 77 130 -96 -114 45 130 152 -190 164 -71 188 -65 2 -86 80 16 -24 -104 -118 -131 123 -165 -195 118 26 164 -169 145 1 -147 -129 -106 -137 -85 -192 107 182 111 -...
output:
41981036
result:
ok 1 number(s): "41981036"
Test #19:
score: 0
Accepted
time: 126ms
memory: 3872kb
input:
62 1 -8 164 -123 -146 11 -34 176 151 -132 -26 -81 39 71 174 -83 -111 29 90 85 153 28 156 -174 0 144 -115 -124 -96 -31 -65 162 128 -118 -9 152 -149 -191 -87 -107 -161 84 200 181 -4 -59 -116 -70 71 -68 -141 108 4 -2 -13 96 155 -188 8 144 -39 -90 -20 -66 -69 -197 -156 136 -36 -14 13 -150 -82 71 91 -119...
output:
30784242
result:
ok 1 number(s): "30784242"
Test #20:
score: 0
Accepted
time: 134ms
memory: 3768kb
input:
45 1 104 177 -54 112 168 192 3 -135 51 -149 35 -105 156 -97 25 161 22 -106 113 -120 -75 71 144 144 -188 -36 110 137 63 -137 43 -81 169 183 184 178 -65 183 -148 185 -15 -196 -164 -154 10 67 -178 188 -81 17 -126 164 97 -87 157 156 104 19 33 146 172 169 121 33 146 -141 166 -20 9 158 116 163 -144 -177 -...
output:
34262460
result:
ok 1 number(s): "34262460"
Test #21:
score: 0
Accepted
time: 130ms
memory: 3784kb
input:
26 1 -19 77 -129 71 57 106 -30 35 54 68 86 109 107 -88 -14 -159 149 178 -39 161 88 -176 -24 -15 171 -89 -90 97 -88 69 188 9 -14 -184 65 -176 77 -145 -98 -5 14 -99 94 158 -192 93 138 175 -142 -68 -29 66 -14 -49 196 130 -14 -40 -13 138 169 41 54 149 46 -122 -3 -156 140 -4 17 26 -90 106 146 -107 -114 26
output:
22630372
result:
ok 1 number(s): "22630372"
Test #22:
score: 0
Accepted
time: 139ms
memory: 3872kb
input:
83 1 150 77 20 -184 -196 23 -128 189 119 194 177 110 -125 -76 -165 11 165 -108 -34 28 100 78 30 23 83 -60 61 20 -15 101 -199 43 -23 95 -18 197 45 -150 104 -53 -10 -53 184 101 -11 -15 125 136 127 -180 29 -14 -33 -150 -73 15 -97 123 62 25 -110 44 -75 99 -58 -32 -57 -85 95 91 -90 12 105 -11 106 172 -18...
output:
44429135
result:
ok 1 number(s): "44429135"
Test #23:
score: 0
Accepted
time: 122ms
memory: 3764kb
input:
37 1 86 -96 195 -92 -11 -166 40 -58 145 -132 -123 64 -196 39 -52 -199 36 -59 41 119 171 131 170 146 -70 12 160 -48 193 -152 57 33 97 -75 -48 -104 -17 36 170 -20 133 9 171 100 44 119 110 -105 -44 -111 -172 43 154 -96 181 80 157 -180 98 -103 -90 -130 -110 -84 173 41 189 -139 55 -144 107 -142 -114 -179...
output:
28728439
result:
ok 1 number(s): "28728439"
Test #24:
score: 0
Accepted
time: 144ms
memory: 3800kb
input:
58 1 -45 174 -64 128 -186 -75 -82 -108 23 -88 -5 17 149 191 -18 122 133 150 -47 -64 100 -2 113 -82 -157 -94 55 194 -56 -61 -117 -83 109 -83 43 -26 107 -24 17 141 -35 -12 53 199 188 68 -145 113 15 -73 -188 164 -56 -171 -46 149 43 2 -153 29 25 -104 35 57 -16 60 -143 -127 -13 78 -143 42 148 -139 187 -1...
output:
37363387
result:
ok 1 number(s): "37363387"
Test #25:
score: 0
Accepted
time: 130ms
memory: 3808kb
input:
42 1 105 -190 -22 174 49 89 -42 163 -189 -61 62 81 190 134 20 -147 -43 117 -95 -104 133 -103 -19 47 159 48 -79 26 -97 -58 -192 138 -118 1 18 14 151 79 -21 -188 -135 -132 151 -164 -3 196 2 11 -62 46 98 135 -29 182 -85 102 -170 -161 -85 105 2 -49 101 -132 40 -133 73 58 79 13 -78 134 -5 -196 186 26 85 ...
output:
33396223
result:
ok 1 number(s): "33396223"
Test #26:
score: 0
Accepted
time: 136ms
memory: 3804kb
input:
50 1 -102 -104 -195 95 81 -157 -119 17 -123 16 -122 -169 147 78 152 48 80 125 -45 -150 -22 111 -85 124 14 -35 -34 -195 9 -128 197 -4 -64 24 -118 100 195 -82 102 50 -132 -104 -100 -95 142 -44 56 176 170 -177 -154 73 109 -158 -143 -184 -178 -160 -1 155 115 -143 107 -98 33 -157 190 -21 62 107 -48 -41 -...
output:
33656374
result:
ok 1 number(s): "33656374"
Test #27:
score: 0
Accepted
time: 140ms
memory: 3800kb
input:
34 1 -166 -133 -99 -128 133 0 -81 193 24 46 18 143 144 94 -167 -9 146 17 -73 52 15 116 132 14 1 -179 139 -194 169 -183 -63 191 10 -90 -50 -121 -96 -170 -197 181 149 182 -180 90 -30 194 -114 -17 -109 146 104 150 -109 -143 56 166 -142 130 123 -8 -50 178 -108 -27 -161 -107 -199 -42 139 78 22 -104 -11 -...
output:
35731863
result:
ok 1 number(s): "35731863"
Test #28:
score: 0
Accepted
time: 137ms
memory: 3792kb
input:
57 1 -93 -132 -143 -33 159 -194 -123 25 -143 -140 -85 74 69 -191 140 57 74 -179 -145 84 177 -73 -191 175 141 149 -134 -36 22 -130 -87 67 133 6 -59 -41 82 -34 -137 -10 -4 4 -194 -185 -143 -60 57 -104 -193 4 -118 -52 -179 33 -85 -87 -38 -126 -100 -79 161 161 -186 24 -126 91 152 -22 -24 -24 -32 138 -19...
output:
42104731
result:
ok 1 number(s): "42104731"
Test #29:
score: 0
Accepted
time: 22ms
memory: 3740kb
input:
5 1 25 -2 20 100 129 -140 -37 133 -181 7 -92 -114 22 116 -82
output:
951995
result:
ok 1 number(s): "951995"
Test #30:
score: 0
Accepted
time: 67ms
memory: 3688kb
input:
5 147 -64 98 50 -143 10 -118 131 -79 62 -59 138 -149 -142 -7 196
output:
884272932
result:
ok 1 number(s): "884272932"
Test #31:
score: 0
Accepted
time: 28ms
memory: 3656kb
input:
5 271828182845 60 -181 -110 -75 196 -71 55 9 -58 -74 -48 -76 91 -177 128
output:
846002797
result:
ok 1 number(s): "846002797"
Test #32:
score: 0
Accepted
time: 140ms
memory: 3988kb
input:
100 1 193 -53 0 96 -132 115 -97 154 -82 173 75 67 -44 91 173 -63 51 -183 -142 99 101 18 -199 -5 -35 181 77 -44 -63 184 -66 -123 -143 138 140 40 0 82 -182 -100 -172 20 142 139 -24 -187 1 -71 131 -145 45 114 84 -141 186 1 -74 132 -7 -150 57 102 -162 -131 -88 123 -92 31 175 162 114 25 152 -54 -119 -10 ...
output:
29842680
result:
ok 1 number(s): "29842680"
Test #33:
score: 0
Accepted
time: 141ms
memory: 3996kb
input:
100 2 -68 44 183 -15 -129 152 -132 143 48 -187 25 -65 116 -88 -138 157 46 -115 77 18 -184 24 53 191 -135 143 -36 161 -96 71 -48 178 78 -3 -59 191 133 -58 -137 -17 -1 -199 25 -197 -23 47 -91 172 6 155 -126 38 107 -164 187 69 -17 23 189 -62 111 -150 74 5 136 -147 -112 7 -166 -61 67 -178 157 -119 -33 -...
output:
237639433
result:
ok 1 number(s): "237639433"
Test #34:
score: 0
Accepted
time: 140ms
memory: 3988kb
input:
100 36 164 -35 109 -181 -61 60 141 61 -128 -117 138 86 65 -74 174 -125 72 139 -183 -60 -53 -171 6 104 144 117 74 -166 -20 -110 -159 -113 -46 -159 -90 -81 79 -65 172 -43 -95 -171 76 91 161 -178 29 86 -130 13 -151 186 26 -70 -165 -105 42 -108 5 -168 -176 -84 -43 77 -79 -167 -171 90 52 39 132 -145 -82 ...
output:
133126869
result:
ok 1 number(s): "133126869"
Test #35:
score: 0
Accepted
time: 142ms
memory: 3988kb
input:
100 899000570 -33 195 29 41 -174 89 173 -52 86 107 149 -79 -194 48 -7 179 86 26 125 -85 -130 -162 110 -41 37 -191 -47 -64 -166 93 88 88 -157 179 67 59 -146 119 -66 -89 168 -63 -73 147 -114 -146 -116 -72 -129 140 -60 160 -96 -70 -93 15 176 38 71 -183 -166 106 -37 31 110 -164 -105 106 133 83 -76 166 -...
output:
642235468
result:
ok 1 number(s): "642235468"
Test #36:
score: 0
Accepted
time: 137ms
memory: 3988kb
input:
100 527256954420915 -100 110 -134 -60 -147 -122 -18 -146 -135 -114 103 128 -38 0 196 157 106 63 79 150 -106 -8 -174 99 -196 -8 40 76 -162 89 47 152 -122 83 -102 150 -36 -79 -180 -75 120 -141 23 -196 -32 -144 114 79 -190 -61 -13 156 101 74 -133 -19 -148 -32 -89 176 -157 108 -61 162 -96 69 175 -48 83 ...
output:
828026607
result:
ok 1 number(s): "828026607"
Test #37:
score: 0
Accepted
time: 149ms
memory: 3944kb
input:
100 2 -113 -117 -33 5 -174 -192 -153 23 -105 -92 178 -100 -43 -70 -94 -29 111 35 3 -164 155 -75 163 117 145 -140 102 -199 150 8 2 -63 -56 -137 -185 -56 165 -41 -88 -20 -94 -178 -47 -60 184 159 17 -148 -108 186 169 3 -51 81 -2 -45 -150 -61 -102 119 -198 -187 124 34 -179 -123 149 -132 -123 177 -147 -5...
output:
354649638
result:
ok 1 number(s): "354649638"
Test #38:
score: 0
Accepted
time: 153ms
memory: 3844kb
input:
100 5 65 -152 -103 -195 110 10 -145 -6 106 105 -20 29 -198 128 57 -89 79 -110 8 159 -6 194 132 -107 -111 88 -54 -74 -171 183 -119 -166 127 -188 33 -151 140 19 -38 -47 193 170 57 -132 16 -105 96 107 -105 -163 -15 55 -165 113 158 -111 -170 51 -92 195 185 93 110 145 149 92 47 -119 149 118 -196 65 -172 ...
output:
580842281
result:
ok 1 number(s): "580842281"
Test #39:
score: 0
Accepted
time: 144ms
memory: 3848kb
input:
100 145361171 112 53 144 61 -115 159 -148 163 22 23 -70 91 -116 -39 142 -7 -132 35 -167 162 -103 47 -169 -18 -180 -103 -116 -163 -62 70 54 79 145 76 -190 -118 10 -39 -179 69 187 78 31 139 -106 126 38 -125 -80 -101 95 151 -32 -9 -100 167 -44 -84 -82 132 59 -188 -106 45 68 165 150 26 -28 137 164 -91 -...
output:
139549314
result:
ok 1 number(s): "139549314"
Test #40:
score: 0
Accepted
time: 153ms
memory: 3856kb
input:
100 52502708246019 12 97 -77 195 163 71 160 64 110 -50 -139 99 -142 -28 -151 -91 89 -60 69 92 100 -195 31 -26 -78 -4 -110 20 12 153 148 -153 -158 144 -37 -3 188 57 164 13 -64 -39 160 177 -67 -6 -126 -189 44 -14 75 -23 96 122 133 179 -83 -161 -181 -111 156 100 -59 165 15 -29 -18 74 180 -46 126 101 63...
output:
722223460
result:
ok 1 number(s): "722223460"