QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#616682 | #1838. Intellectual Implementation | lopgov | AC ✓ | 2840ms | 407508kb | C++14 | 12.5kb | 2024-10-06 10:05:13 | 2024-10-06 10:05:13 |
Judging History
answer
#include <bits/stdc++.h>
#define int long long
// #define int __int128_t
#define ll long long
#define ull unsigned long long
#define min std::min
#define max std::max
#define swap std::swap
namespace IO
{
const int N = 1e6 + 5;
char obuf[N], * p3 = obuf; char ibuf[N], * p1 = ibuf, * p2 = ibuf;
inline void flush() { fwrite(obuf, p3 - obuf, 1, stdout); p3 = obuf; }
inline void putch(char x) { (p3 - obuf < N) ? (*p3++ = x) : (flush(), *p3++ = x); }
inline char getch() { return p1 == p2 && (p2 = (p1 = ibuf) + fread(ibuf, 1, N, stdin), p1 == p2) ? EOF : *p1++; }
inline bool READ(char& p) { p = getch(); while (p == ' ' || p == '\n' || p == -1) { if (p == -1) return true; p = getch(); } return false; }
inline bool READ(char* p) { char ch = getch(); while (ch == ' ' || ch == '\n' || ch == -1) { if (ch == -1) return true; ch = getch(); } while (ch != ' ' && ch != '\n' && ch != -1) { *p++ = ch; ch = getch(); } *p++ = '\0'; return ch == -1; }
inline bool READ(std::string& str) { str = ""; char ch = getch(); while (ch == ' ' || ch == '\n' || ch == -1) { if (ch == -1) return true; ch = getch(); } while (ch != ' ' && ch != '\n' && ch != -1) { str += ch; ch = getch(); } return ch == -1; }
inline bool READ(signed& x) { register char ch = getch(); while (ch < '0' || ch > '9') { if (ch == -1) return true; if (ch == '-') { if (READ(x)) { x = -x; return true; } x = -x; return false; } ch = getch(); } x = 0; while (ch <= '9' && ch >= '0') { x = (x << 3) + (x << 1) + (ch ^ 48); ch = getch(); } if (ch == -1) return true; return false; } inline bool READ(unsigned& x) { register char ch = getch(); while (ch < '0' || ch > '9') { if (ch == -1) return true; ch = getch(); } x = 0; while (ch <= '9' && ch >= '0') { x = (x << 3) + (x << 1) + (ch ^ 48); ch = getch(); } if (ch == -1) return true; return false; }
inline bool READ(short& x) { register char ch = getch(); while (ch < '0' || ch > '9') { if (ch == -1) return true; if (ch == '-') { if (READ(x)) { x = -x; return true; } x = -x; return false; } ch = getch(); } x = 0; while (ch <= '9' && ch >= '0') { x = (x << 3) + (x << 1) + (ch ^ 48); ch = getch(); } if (ch == -1) return true; return false; } inline bool READ(unsigned short& x) { register char ch = getch(); while (ch < '0' || ch > '9') { if (ch == -1) return true; ch = getch(); } x = 0; while (ch <= '9' && ch >= '0') { x = (x << 3) + (x << 1) + (ch ^ 48); ch = getch(); } if (ch == -1) return true; return false; }
inline bool READ(long long& x) { register char ch = getch(); while (ch < '0' || ch > '9') { if (ch == -1) return true; if (ch == '-') { if (READ(x)) { x = -x; return true; } x = -x; return false; } ch = getch(); } x = 0; while (ch <= '9' && ch >= '0') { x = (x << 3) + (x << 1) + (ch ^ 48); ch = getch(); } if (ch == -1) return true; return false; } inline bool READ(unsigned long long& x) { register char ch = getch(); while (ch < '0' || ch > '9') { if (ch == -1) return true; ch = getch(); } x = 0; while (ch <= '9' && ch >= '0') { x = (x << 3) + (x << 1) + (ch ^ 48); ch = getch(); } if (ch == -1) return true; return false; }
inline bool READ(__int128_t& x) { register char ch = getch(); while (ch < '0' || ch > '9') { if (ch == -1) return true; if (ch == '-') { if (READ(x)) { x = -x; return true; } x = -x; return false; } ch = getch(); } x = 0; while (ch <= '9' && ch >= '0') { x = (x << 3) + (x << 1) + (ch ^ 48); ch = getch(); } if (ch == -1) return true; return false; } inline bool READ(__uint128_t& x) { register char ch = getch(); while (ch < '0' || ch > '9') { if (ch == -1) return true; ch = getch(); } x = 0; while (ch <= '9' && ch >= '0') { x = (x << 3) + (x << 1) + (ch ^ 48); ch = getch(); } if (ch == -1) return true; return false; }
inline bool read() { return false; }
template < typename T, typename ... T2 > inline bool read(T& x, T2& ... oth) { if (READ(x)) return true; return read(oth...); }
inline int Read() { register int x = 0; read(x); return x; }
inline void WRITE(char ch) { putch(ch); }
inline void WRITE(char* ch) { register int len = strlen(ch); for (register int i = 0; i < len; i++) putch(ch[i]); }
inline void WRITE(std::string ch) { register int siz = ch.size(); for (register int i = 0; i < siz; i++) putch(ch[i]); }
inline void WRITE(signed x) { if (!x) { putch('0'); return; } register int len = 0; register signed k1 = x; register char c[50] = {}; if (k1 < 0) k1 = -k1, putch('-'); while (k1) c[len++] = k1 % 10 ^ 48, k1 /= 10; while (len--) putch(c[len]); }
inline void WRITE(unsigned x) { if (!x) { putch('0'); return; } register int len = 0; register unsigned k1 = x; register char c[50] = {}; while (k1) c[len++] = k1 % 10 ^ 48, k1 /= 10; while (len--) putch(c[len]); }
inline void WRITE(short x) { if (!x) { putch('0'); return; } register int len = 0; register short k1 = x; register char c[50] = {}; if (k1 < 0) k1 = -k1, putch('-'); while (k1) c[len++] = k1 % 10 ^ 48, k1 /= 10; while (len--) putch(c[len]); }
inline void WRITE(unsigned short x) { if (!x) { putch('0'); return; } register int len = 0; register unsigned short k1 = x; register char c[50] = {}; while (k1) c[len++] = k1 % 10 ^ 48, k1 /= 10; while (len--) putch(c[len]); }
inline void WRITE(long long x) { if (!x) { putch('0'); return; } register int len = 0; register long long k1 = x; register char c[50] = {}; if (k1 < 0) k1 = -k1, putch('-'); while (k1) c[len++] = k1 % 10 ^ 48, k1 /= 10; while (len--) putch(c[len]); }
inline void WRITE(unsigned long long x) { if (!x) { putch('0'); return; } register int len = 0; register unsigned long long k1 = x; register char c[50] = {}; while (k1) c[len++] = k1 % 10 ^ 48, k1 /= 10; while (len--) putch(c[len]); }
inline void WRITE(__int128_t x) { if (!x) { putch('0'); return; } register int len = 0; register __int128_t k1 = x; register char c[50] = {}; if (k1 < 0) k1 = -k1, putch('-'); while (k1) c[len++] = k1 % 10 ^ 48, k1 /= 10; while (len--) putch(c[len]); }
inline void WRITE(__uint128_t x) { if (!x) { putch('0'); return; } register int len = 0; register __uint128_t k1 = x; register char c[50] = {}; while (k1) c[len++] = k1 % 10 ^ 48, k1 /= 10; while (len--) putch(c[len]); }
inline void write() { }
template < typename T, typename ... T2 > inline void write(T x, T2 ... oth) { WRITE(x); write(oth...); }
template < typename T, typename ... T2 > inline void writef(T x, T2 ... oth) { WRITE(x); write(oth...); flush(); }
} using IO::getch; using IO::READ; using IO::WRITE; using IO::read; using IO::write; using IO::writef; using IO::flush; using IO::putch; using IO::getch; using IO::Read;
using namespace std;
const int N = 6e5 + 5;
int n;
struct Node { int x1, x2, y1, y2; }; Node s[N];
int X[N], Y[N];
int idx1, idx2;
inline ll calc(ll a, ll b, ll c)
{
return c - b - b - b + a + a;
}
struct SegmentTree
{
struct Node
{
int l, r, add;
ll sum1, sum2, sum3;
};
Node tree[N << 2];
inline void pushup(int x)
{
tree[x].sum1 = tree[x << 1].sum1 + tree[x << 1 | 1].sum1;
tree[x].sum2 = tree[x << 1].sum2 + tree[x << 1 | 1].sum2;
tree[x].sum3 = tree[x << 1].sum3 + tree[x << 1 | 1].sum3;
}
inline void add_tag(int x, int k)
{
tree[x].add += k;
tree[x].sum3 += 3 * tree[x].sum2 * k + 3 * tree[x].sum1 * k * k + 1ll * k * k * k * (tree[x].r - tree[x].l + 1);
tree[x].sum2 += 2 * tree[x].sum1 * k + 1ll * k * k * (tree[x].r - tree[x].l + 1);
tree[x].sum1 += 1ll * k * (tree[x].r - tree[x].l + 1);
}
inline void pushdown(int x)
{
if (tree[x].add)
{
add_tag(x << 1, tree[x].add);
add_tag(x << 1 | 1, tree[x].add);
tree[x].add = 0;
}
}
void build(int x)
{
tree[x].sum1 = tree[x].sum2 = tree[x].sum3 = tree[x].add = 0;
if (tree[x].l == tree[x].r) return ;
tree[x << 1].l = tree[x].l, tree[x << 1].r = tree[x].l + tree[x].r >> 1;
tree[x << 1 | 1].l = tree[x << 1].r + 1, tree[x << 1 | 1].r = tree[x].r;
build(x << 1), build(x << 1 | 1);
}
void updata(int x, int l, int r, int k)
{
if (tree[x].l >= l && tree[x].r <= r) return add_tag(x, k);
pushdown(x);
if (l <= tree[x << 1].r) updata(x << 1, l, r, k);
if (r >= tree[x << 1 | 1].l) updata(x << 1 | 1, l, r, k);
pushup(x);
}
int query(int x, int l, int r)
{
if (tree[x].l >= l && tree[x].r <= r) return calc(tree[x].sum1, tree[x].sum2, tree[x].sum3);
pushdown(x);
if (l > tree[x << 1].r) return query(x << 1 | 1, l, r);
if (r < tree[x << 1 | 1].l) return query(x << 1, l, r);
return query(x << 1, l, r) + query(x << 1 | 1, l, r);
}
inline int query() { return calc(tree[1].sum1, tree[1].sum2, tree[1].sum3); }
};
inline int lowbit(int x) { return x & -x; }
struct BIT
{
int tree[N];
inline void add(int x, int y) { for (; x <= idx2; x += lowbit(x)) tree[x] += y; }
inline int sum(int x) { int res = 0; for (; x; x -= lowbit(x)) res += tree[x]; return res; }
};
vector < pair < int, int > > add[6][N];
vector < pair < int, int > > sub[6][N];
vector < int > ADD[N], SUB[N];
SegmentTree st;
BIT bit[2][2];
int d[N];
int ans1, ans2;
inline void ___()
{
read(n);
for (int i = 1; i <= n; i++)
{
read(s[i].x1, s[i].x2, s[i].y1, s[i].y2);
X[++idx1] = s[i].x1, X[++idx1] = s[i].x2;
X[++idx1] = s[i].x2 - 1;
Y[++idx2] = s[i].y1, Y[++idx2] = s[i].y2;
Y[++idx2] = s[i].y2 - 1;
}
sort(X + 1, X + 1 + idx1), idx1 = unique(X + 1, X + 1 + idx1) - X - 1;
sort(Y + 1, Y + 1 + idx2), idx2 = unique(Y + 1, Y + 1 + idx2) - Y - 1;
for (int i = 1; i <= n; i++)
{
s[i].x1 = lower_bound(X + 1, X + 1 + idx1, s[i].x1) - X;
s[i].x2 = lower_bound(X + 1, X + 1 + idx1, s[i].x2) - X;
s[i].y1 = lower_bound(Y + 1, Y + 1 + idx2, s[i].y1) - Y;
s[i].y2 = lower_bound(Y + 1, Y + 1 + idx2, s[i].y2) - Y;
add[0][s[i].x1].emplace_back(s[i].y1, s[i].y2);
sub[0][s[i].x2].emplace_back(s[i].y1, s[i].y2);
ADD[s[i].x1].emplace_back(i);
SUB[s[i].x2].emplace_back(i);
//包含(x, y)
add[1][s[i].x1].emplace_back(s[i].y1, s[i].y2 - 1);
sub[1][s[i].x2 - 1].emplace_back(s[i].y1, s[i].y2 - 1);
//包含(x, y), (x + 1, y + 1)
add[2][s[i].x1].emplace_back(s[i].y1, s[i].y2 - 1);
sub[2][s[i].x2].emplace_back(s[i].y1, s[i].y2 - 1);
//包含(x, y), (x, y + 1)
add[3][s[i].x1].emplace_back(s[i].y1, s[i].y2);
sub[3][s[i].x2 - 1].emplace_back(s[i].y1, s[i].y2);
//包含(x, y), (x + 1, y)
}
st.tree[1].l = 1, st.tree[1].r = idx2, st.build(1);
for (int i = 1; i <= idx1; i++)
{
for (int j = add[0][i].size() * 1ll - 1ll; j >= 0; j--) st.updata(1, add[0][i][j].first, add[0][i][j].second, 1);
ans1 += st.query();
for (int j = sub[0][i].size() * 1ll - 1ll; j >= 0; j--) st.updata(1, sub[0][i][j].first, sub[0][i][j].second, -1);
for (int j = add[0][i].size() * 1ll - 1ll; j >= 0; j--)
{
d[ADD[i][j]] += bit[0][0].sum(add[0][i][j].second) - bit[0][1].sum(add[0][i][j].first - 1);
d[ADD[i][j]] -= bit[1][0].sum(add[0][i][j].second) - bit[1][1].sum(add[0][i][j].first - 1);
bit[0][0].add(add[0][i][j].first, 1);
bit[0][1].add(add[0][i][j].second, 1);
bit[1][0].add(add[0][i][j].first, 1);
bit[1][1].add(add[0][i][j].second, 1);
}
for (int j = sub[0][i].size() * 1ll - 1ll; j >= 0; j--)
{
d[SUB[i][j]] += bit[1][0].sum(sub[0][i][j].second) - bit[1][1].sum(sub[0][i][j].first - 1);
bit[0][0].add(sub[0][i][j].first, -1);
bit[0][1].add(sub[0][i][j].second, -1);
}
}
st.tree[1].l = 1, st.tree[1].r = idx2, st.build(1);
for (int i = 1; i <= idx1; i++)
{
for (int j = add[1][i].size() * 1ll - 1ll; j >= 0; j--) st.updata(1, add[1][i][j].first, add[1][i][j].second, 1);
ans1 += st.query();
for (int j = sub[1][i].size() * 1ll - 1ll; j >= 0; j--) st.updata(1, sub[1][i][j].first, sub[1][i][j].second, -1);
}
st.tree[1].l = 1, st.tree[1].r = idx2, st.build(1);
for (int i = 1; i <= idx1; i++)
{
for (int j = add[2][i].size() * 1ll - 1ll; j >= 0; j--) st.updata(1, add[2][i][j].first, add[2][i][j].second, 1);
ans1 -= st.query();
for (int j = sub[2][i].size() * 1ll - 1ll; j >= 0; j--) st.updata(1, sub[2][i][j].first, sub[2][i][j].second, -1);
}
st.tree[1].l = 1, st.tree[1].r = idx2, st.build(1);
for (int i = 1; i <= idx1; i++)
{
for (int j = add[3][i].size() * 1ll - 1ll; j >= 0; j--) st.updata(1, add[3][i][j].first, add[3][i][j].second, 1);
ans1 -= st.query();
for (int j = sub[3][i].size() * 1ll - 1ll; j >= 0; j--) st.updata(1, sub[3][i][j].first, sub[3][i][j].second, -1);
}
ans1 /= 6;
for (int i = 1; i <= n; i++)
{
d[i]--;
ans2 += d[i] * (n - 1 - d[i]);
}
ans2 /= 2;
write(1ll * n * (n - 1) * (n - 2) / 6 - ans1 - ans2);
}
signed main()
{
// freopen("rectangle.in", "r", stdin), freopen("rectangle.out", "w", stdout);
int _ = 1;
// read(_);
while (_--) ___();
flush();
return ~(0 ^ _ ^ 0);
}
详细
Test #1:
score: 100
Accepted
time: 32ms
memory: 214632kb
input:
5 1 5 1 5 4 8 2 6 3 7 3 7 2 6 28 32 42 46 42 46
output:
3
result:
ok 1 number(s): "3"
Test #2:
score: 0
Accepted
time: 32ms
memory: 210500kb
input:
6 1 8 6 10 2 5 3 12 3 4 15 20 0 9 2 22 -5 22 -2 23 -7 11 -1 17
output:
0
result:
ok 1 number(s): "0"
Test #3:
score: 0
Accepted
time: 35ms
memory: 212532kb
input:
10 -114 -46 148 199 -27 187 -26 190 -64 -16 151 228 -162 -44 -107 -96 45 185 -197 -128 100 180 -23 222 -152 138 52 181 141 193 -109 87 -87 175 -35 123 -110 227 -73 -44
output:
41
result:
ok 1 number(s): "41"
Test #4:
score: 0
Accepted
time: 30ms
memory: 210408kb
input:
10 -41 251 194 288 -194 69 -194 130 -17 23 -74 -60 -321 -236 89 298 -55 233 53 137 -32 114 -46 -24 -183 312 -286 322 -205 5 -222 67 14 119 -126 15 -76 57 -122 27
output:
20
result:
ok 1 number(s): "20"
Test #5:
score: 0
Accepted
time: 25ms
memory: 210440kb
input:
10 -68 10 22 87 30 89 -97 82 -52 25 -22 76 -20 95 21 25 -3 2 -7 45 -98 -56 -15 16 -79 -11 -73 -29 -71 59 -67 -40 -78 -46 -81 85 -62 -23 -90 -59
output:
24
result:
ok 1 number(s): "24"
Test #6:
score: 0
Accepted
time: 29ms
memory: 210420kb
input:
5 5 10 -15 -5 -11 6 2 13 7 8 -9 -2 -2 0 -3 10 -13 3 0 8
output:
0
result:
ok 1 number(s): "0"
Test #7:
score: 0
Accepted
time: 42ms
memory: 216580kb
input:
20 -12 9 10 21 -14 15 4 20 -3 22 12 29 -15 -13 -10 2 -5 14 -25 23 -6 28 -16 18 -7 24 -28 -21 25 26 -20 -2 -26 -11 -30 28 18 30 -27 -12 7 12 -17 -3 -23 -18 -9 -5 -22 8 9 25 -10 27 -24 -4 -4 10 17 24 2 23 -29 6 -24 19 26 27 -2 17 1 8 -8 16 -23 15 -19 -1 3 16
output:
300
result:
ok 1 number(s): "300"
Test #8:
score: 0
Accepted
time: 35ms
memory: 210532kb
input:
100 119 194 50 138 -42 74 -161 189 172 179 -127 35 -80 -74 -28 -8 -158 -88 42 155 7 182 41 123 -48 61 -100 -39 56 171 -154 -104 63 109 -27 5 96 107 -199 171 -110 98 142 159 -189 79 -62 97 148 159 -69 120 -11 155 -31 40 -1 1 -81 -48 125 130 74 179 -144 140 -70 154 -123 -19 -45 -37 -69 50 -121 -64 -18...
output:
30008
result:
ok 1 number(s): "30008"
Test #9:
score: 0
Accepted
time: 30ms
memory: 212584kb
input:
100 -127 147 -71 149 -76 75 -135 34 32 137 -154 -37 -102 67 28 125 -3 142 -102 -81 92 112 13 58 -22 118 -143 106 -1 146 19 156 23 93 -90 -43 84 132 40 119 -65 29 -74 26 79 88 121 148 -158 -12 -107 -51 -32 115 -96 -87 -153 -104 -9 68 -130 -129 -156 159 -123 156 -69 -2 -134 -83 -138 76 152 153 -27 117...
output:
36432
result:
ok 1 number(s): "36432"
Test #10:
score: 0
Accepted
time: 34ms
memory: 210592kb
input:
50 2 55 -27 -12 -22 92 -11 43 -7 15 3 98 -57 -10 -89 95 -13 -1 -45 6 -93 31 35 61 5 87 -70 -62 -95 19 -38 63 -75 100 -16 -5 -85 23 19 30 -28 96 -57 16 -63 47 -74 74 -20 65 -13 53 -17 67 -33 99 -87 60 -83 -26 -16 30 -64 92 -6 83 -56 64 -89 81 -81 -67 -25 88 -28 73 42 73 -7 22 -82 -72 -60 41 -49 9 36 ...
output:
3163
result:
ok 1 number(s): "3163"
Test #11:
score: 0
Accepted
time: 38ms
memory: 210508kb
input:
80 -49 -30 -69 41 -18 18 -19 109 -105 5 43 55 -23 53 26 65 -51 -46 -43 70 -33 55 -30 118 26 77 -97 -81 -69 108 -102 22 -100 84 -46 -37 45 102 -8 116 -11 19 27 117 -85 115 1 21 -53 -37 -39 -6 12 46 -51 105 2 112 -74 111 49 73 -95 97 -91 -34 -54 99 -103 -17 -62 60 -120 34 107 112 -65 91 37 54 0 29 -11...
output:
18042
result:
ok 1 number(s): "18042"
Test #12:
score: 0
Accepted
time: 31ms
memory: 208480kb
input:
100 -841118249 54124743 -626326499 268957660 -67982407 863071822 -701390018 -698615688 -442643513 576076137 -764229963 551005051 431006196 814541207 -59789787 297920747 -43726137 776889568 123191521 355546306 449575877 539401232 -547154377 156487400 -242017904 -56664269 71627074 636983445 -533630763...
output:
33574
result:
ok 1 number(s): "33574"
Test #13:
score: 0
Accepted
time: 33ms
memory: 210580kb
input:
200 -159856875 589617180 -91740528 827012068 -3244468 100974204 -204897309 624235032 740363419 811458184 -770093768 -459183292 -748577744 537657877 -919036011 26850784 -674800746 -335189105 -487556614 623807767 -759398571 -749755285 -236633574 905693829 -112618074 250091661 520796982 549786377 -6798...
output:
247012
result:
ok 1 number(s): "247012"
Test #14:
score: 0
Accepted
time: 28ms
memory: 210568kb
input:
300 -911895578 -569581980 147878148 795131888 -661123414 -528441116 242053045 343472902 -76629649 803750439 773718158 980952637 260774546 366805612 -674049855 -181475940 -626652074 -421458352 -803337455 840191725 -244053740 184891420 -345099744 -169202563 -610128030 -226308036 -999353606 -735065818 ...
output:
1004267
result:
ok 1 number(s): "1004267"
Test #15:
score: 0
Accepted
time: 42ms
memory: 210572kb
input:
400 -830909902 861153449 -941780998 682464119 -220613384 281811674 -140128942 596875820 -960867515 -893622718 -236470184 975088832 -569688535 278858509 108993388 443221717 -918115043 -168115959 -891546816 880881705 -870818590 261647805 109139390 141318241 -96908206 -8404805 -791583380 -285895911 -97...
output:
2460666
result:
ok 1 number(s): "2460666"
Test #16:
score: 0
Accepted
time: 33ms
memory: 208664kb
input:
500 -298045711 417051395 -782949912 -678693884 -480285944 -450842739 -817278222 -611664178 -725485468 289384214 431167941 996431266 296942472 545694821 529862288 892036630 -966488219 380193728 -623285356 322011072 -937683357 -464585685 208749252 563378525 32491625 836408211 753208585 826252259 -9271...
output:
5193294
result:
ok 1 number(s): "5193294"
Test #17:
score: 0
Accepted
time: 28ms
memory: 210732kb
input:
600 203069778 837722424 -543331236 -415606770 -386104799 757616438 -358261261 800539792 -733193213 -527608855 -603691664 425304136 -338921825 20059141 -324920128 616502859 -962983894 390446329 -583704357 -355023895 -431981811 479704306 -982382342 571147558 -561868565 -81198337 -797621509 -722887724 ...
output:
7677331
result:
ok 1 number(s): "7677331"
Test #18:
score: 0
Accepted
time: 36ms
memory: 212744kb
input:
700 -254001632 25368060 -303712559 -152519656 -616334153 -56358682 433198742 956414891 -497811166 117340991 124473038 629209786 38143104 724584029 -79933972 703143429 745553138 938756017 -899485198 -138639937 -524128202 -221247560 9913878 586701067 48201493 282944451 -810084792 -53484308 202718665 6...
output:
12296144
result:
ok 1 number(s): "12296144"
Test #19:
score: 0
Accepted
time: 39ms
memory: 211396kb
input:
2000 -580297120 549197350 -598869041 879583075 -954556446 -62577411 -803731747 335487679 -689376577 785481974 16605213 888665084 -320257042 329495972 491782245 670597773 347303891 363810780 -440727101 99207071 354771150 530453687 -499509583 407580550 -363375564 650395473 -31669850 374805738 -9452822...
output:
313938221
result:
ok 1 number(s): "313938221"
Test #20:
score: 0
Accepted
time: 52ms
memory: 212480kb
input:
5000 -591270635 510694320 83206315 186982934 -697045084 -198641774 -375097474 752780107 -702494041 -200162855 -980400671 -923640406 -418088873 614160702 -623846134 -30029692 -272220084 518501838 -655904295 910767648 132927998 169713224 -675737799 -241853350 -538544803 -21550989 -714286937 -378442715...
output:
4558798032
result:
ok 1 number(s): "4558798032"
Test #21:
score: 0
Accepted
time: 97ms
memory: 217164kb
input:
10000 -201957185 118307450 -266375727 745966927 -736796598 75870065 471448807 594899198 -723586512 655989486 -73931815 245738688 -984988678 906250107 -589969172 517901031 -799809845 759583842 -220308400 398919680 -488446145 777931876 -676675087 -646648304 -876126176 -209651494 97786386 417944889 -36...
output:
36473099188
result:
ok 1 number(s): "36473099188"
Test #22:
score: 0
Accepted
time: 1223ms
memory: 311392kb
input:
100000 226564148 486750691 -450254989 466727591 -502609877 -3752654 -440437681 500722941 -983190884 202308173 -544037788 -57081694 70916258 294751219 -290590129 873004953 723830371 964799716 -177364196 91139653 534342079 544990348 -632680846 666392090 -906658216 -423388042 -210927029 816790191 -8911...
output:
37183181239478
result:
ok 1 number(s): "37183181239478"
Test #23:
score: 0
Accepted
time: 2689ms
memory: 405564kb
input:
200000 367031365 380518706 -590955530 -145803774 30572786 915595795 -492108235 -76144590 -206184243 482187782 166234680 411061068 -160448386 93871862 -690036834 -413709526 -928088982 -582615677 -200003644 653596324 -391991446 -148169696 58890373 876425548 -657005544 13191918 -518772663 979443176 739...
output:
297858270782347
result:
ok 1 number(s): "297858270782347"
Test #24:
score: 0
Accepted
time: 2443ms
memory: 405448kb
input:
200000 -225636631 970953278 -551217116 569289094 -386591114 874277277 227774719 368531094 414874571 744129011 167365910 489367267 -101394885 252157771 -935558478 -921784933 -332996759 193645059 450365810 615535977 534268382 839442266 -651344308 973612355 -812834130 -463779096 -908813542 988376312 -8...
output:
300088515091234
result:
ok 1 number(s): "300088515091234"
Test #25:
score: 0
Accepted
time: 2728ms
memory: 405420kb
input:
200000 -760211388 42056124 187370466 662010342 -950028200 909542645 -810431015 -267421984 -256202835 671322162 -356383109 -101939354 260772572 708149873 -130443586 834223039 -471047217 750658799 -707049350 -400288110 -669122331 574041864 -200846059 112227901 -421966055 349825346 2584613 803301379 -7...
output:
299317567765471
result:
ok 1 number(s): "299317567765471"
Test #26:
score: 0
Accepted
time: 2807ms
memory: 403536kb
input:
200000 -607025449 422340287 208590202 787872296 -560243992 795908494 171563580 561131367 -21277979 499711837 -990850781 315353074 -932236149 893694354 -676563240 -294476635 -568879047 -189586820 -422384620 899084426 -131595505 988329603 -280713171 612591604 -487739224 -162196229 -416733396 581458227...
output:
299452022544391
result:
ok 1 number(s): "299452022544391"
Test #27:
score: 0
Accepted
time: 2781ms
memory: 404068kb
input:
200000 -353795267 -72450692 -668444954 833598622 143622250 863303762 -643752691 755639156 -499956318 -277725570 -813946559 -798373012 84149596 816059259 -790850687 -741312049 -147276564 969847415 -85091488 735030540 -571153407 948556121 337581491 457060648 -581429766 675144296 569058303 574376014 23...
output:
299139726450686
result:
ok 1 number(s): "299139726450686"
Test #28:
score: 0
Accepted
time: 2611ms
memory: 407508kb
input:
200000 -617996869 279869790 355290630 842758249 411598902 577463371 -805271492 561017689 768119544 849969331 -835412646 801721101 612385160 985328506 314735514 411888407 275797722 666732704 -229323442 482005409 -461351447 -91443934 -466036854 984932471 28297600 884470395 -393202949 1928682 -26489602...
output:
300307736868420
result:
ok 1 number(s): "300307736868420"
Test #29:
score: 0
Accepted
time: 2716ms
memory: 353088kb
input:
200000 -219806 87059 -331800 15467 -398900 -156419 -191467 -31392 -180415 190637 -56257 369691 -251590 -239726 -145539 311463 -383962 -337339 125245 270519 -397922 -120176 -191769 376026 -36330 275900 -291524 27697 339087 388026 -255842 -177030 -37402 47488 -258929 255008 -323046 -89972 -386706 1531...
output:
297006755898278
result:
ok 1 number(s): "297006755898278"
Test #30:
score: 0
Accepted
time: 2756ms
memory: 357116kb
input:
200000 -64205 415759 18371 176549 -356219 455332 182159 380632 -148533 -6548 -307252 466748 -433538 -197819 12331 217327 -366031 271135 -442357 -139359 29091 499051 -160979 448862 -3397 341051 -327855 461482 -435024 9154 104065 158233 102967 476382 -121788 322416 9360 475240 9803 284989 -175083 2965...
output:
296698907698133
result:
ok 1 number(s): "296698907698133"
Test #31:
score: 0
Accepted
time: 2840ms
memory: 403380kb
input:
200000 -1087845 4754710 2899905 3507907 92042 719716 212637 1684307 -1807754 2196421 -4233981 -669938 -2872558 -407329 -3859314 -392538 -1981106 606603 -1402557 -767511 4567096 4785610 -135473 1068806 -2692479 -1839766 -2427870 928598 -3873136 4633760 -497884 2551791 -4980919 4103129 -3984158 202326...
output:
297707734978257
result:
ok 1 number(s): "297707734978257"
Test #32:
score: 0
Accepted
time: 2625ms
memory: 351168kb
input:
200000 -161706 123833 -337725 79849 -167211 -32288 -332709 -46049 -179529 -39672 -88309 204596 242670 265751 34087 140544 -104435 168695 -66676 203705 -304326 208485 83541 215514 -314871 287643 -151603 117949 -308301 133510 -147734 43907 -297458 87087 -148393 259194 -51666 244952 -327479 16194 -8009...
output:
298463780366978
result:
ok 1 number(s): "298463780366978"
Test #33:
score: 0
Accepted
time: 772ms
memory: 347556kb
input:
200000 1 200002 1 200002 2 200003 2 200003 3 200004 3 200004 4 200005 4 200005 5 200006 5 200006 6 200007 6 200007 7 200008 7 200008 8 200009 8 200009 9 200010 9 200010 10 200011 10 200011 11 200012 11 200012 12 200013 12 200013 13 200014 13 200014 14 200015 14 200015 15 200016 15 200016 16 200017 1...
output:
0
result:
ok 1 number(s): "0"
Test #34:
score: 0
Accepted
time: 781ms
memory: 347336kb
input:
199999 1 200001 1 200001 2 200002 2 200002 3 200003 3 200003 4 200004 4 200004 5 200005 5 200005 6 200006 6 200006 7 200007 7 200007 8 200008 8 200008 9 200009 9 200009 10 200010 10 200010 11 200011 11 200011 12 200012 12 200012 13 200013 13 200013 14 200014 14 200014 15 200015 15 200015 16 200016 1...
output:
0
result:
ok 1 number(s): "0"