QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#59100 | #212. Wyspa [A] | hhblw | 10 ✓ | 407ms | 49348kb | C++23 | 8.8kb | 2022-10-27 22:23:49 | 2022-10-27 22:24:18 |
Judging History
answer
#include <cstdio>
#include <algorithm>
using namespace std;
const int N = 500010, M = 2000010, P = 1000000007;
int n, m, ca, cb, cnt, i, j, k, x, y, scc, base = 1;
bool vis[N];
int ed, g[N], v[M], nxt[M], G[N], V[M], NXT[M];
int id[N], at[N], q[N], t;
int pool[N], st[N], en[N], cp, last[N];
int ce;
struct Info {
int a, b, c, d;
} f[N];
struct E {
int l, r;
E() {} E(int _l, int _r) {
l = _l, r = _r;
}
} e[N << 1];
inline bool cmp(const E &a, const E &b) {
return a.l < b.l;
}
inline void read(int &a) {
char c;
while (!(((c = getchar()) >= '0') && (c <= '9')))
;
a = c - '0';
while (((c = getchar()) >= '0') && (c <= '9'))
(a *= 10) += c - '0';
}
inline void readch(char &a) {
while (!(((a = getchar()) == '-') || (a == '>')))
;
}
inline void umin(int &a, int b) {
a > b ? (a = b) : 0;
}
inline void umax(int &a, int b) {
a < b ? (a = b) : 0;
}
inline void add(int x, int y) {
v[++ed] = y;
nxt[ed] = g[x];
g[x] = ed;
V[ed] = x;
NXT[ed] = G[y];
G[y] = ed;
}
void dfs(int x) {
if (vis[x])
return;
vis[x] = 1;
for (int i = g[x]; i; i = nxt[i])
dfs(v[i]);
}
void dfs1(int x) {
if (vis[x])
return;
vis[x] = 1;
for (int i = g[x]; i; i = nxt[i])
dfs1(v[i]);
q[++t] = x;
}
void dfs2(int x) {
if (!vis[x])
return;
vis[x] = 0;
at[x] = scc;
pool[++cp] = x;
for (int i = G[x]; i; i = NXT[i])
dfs2(V[i]);
}
inline void ext(int o, int x, int y) {
if (!x)
return;
if (!f[o].a)
f[o].a = x, f[o].b = y;
else if (!f[o].c)
f[o].c = x, f[o].d = y;
else
puts("GG");
}
namespace COUNTING {
typedef unsigned int uint32;
typedef long long int64;
typedef unsigned long long uint64;
typedef uint32 word;
typedef uint64 dword;
typedef int sword;
const int word_bits = sizeof(word) * 8;
word mod, Modinv, r2;
struct UnsafeMod {
word x;
UnsafeMod(): x(0) {}
UnsafeMod(word _x): x(init(_x)) {}
UnsafeMod &operator += (const UnsafeMod &rhs) {
(x += rhs.x) >= mod && (x -= mod);
return *this;
}
UnsafeMod &operator -= (const UnsafeMod &rhs) {
sword(x -= rhs.x) < 0 && (x += mod);
return *this;
}
UnsafeMod &operator *= (const UnsafeMod &rhs) {
x = reduce(dword(x) * rhs.x);
return *this;
}
UnsafeMod operator + (const UnsafeMod &rhs) const {
return UnsafeMod(*this) += rhs;
}
UnsafeMod operator - (const UnsafeMod &rhs) const {
return UnsafeMod(*this) -= rhs;
}
UnsafeMod operator * (const UnsafeMod &rhs) const {
return UnsafeMod(*this) *= rhs;
}
UnsafeMod pow(uint64 e) const {
UnsafeMod ret(1);
for (UnsafeMod base = *this; e; e >>= 1, base *= base) {
if (e & 1)
ret *= base;
}
return ret;
}
word get() const {
return reduce(x);
}
static word modulus() {
return mod;
}
static word init(word w) {
return reduce(dword(w) * r2);
}
static void set_mod(word m) {
mod = m;
Modinv = mul_inv(mod);
r2 = -dword(mod) % mod;
}
static word reduce(dword x) {
word y = word(x >> word_bits) - word((dword(word(x) * Modinv) * mod) >> word_bits);
return sword(y) < 0 ? y + mod : y;
}
static word mul_inv(word n, int e = 6, word x = 1) {
return !e ? x : mul_inv(n, e - 1, x * (2 - x * n));
}
} dp[N], v[N], ans;
int n, m, _, ca, i, j, k, x, y, e[N][2], is[N], a[N];
int p[N], val[N];
int minlen, S, now, en;
int g[N], q[N][2], h, t;
int f[N << 1], lim[N];
inline void init(int A, int B, int C, int D) {
if (!C) {
e[++m][0] = A;
e[m][1] = B;
umax(f[B], A);
umax(f[B + n], A + n);
} else {
e[++m][0] = C;
e[m][1] = B;
umax(f[B + n], C);
}
}
inline void add(int l, int r) {
if (l <= r) {
if (f[r] > l)
return;
is[l - 1] = is[r] = 1;
} else {
if (f[r + n] > l)
return;
is[l - 1] = is[r] = is[n] = 1;
}
e[++_][0] = l;
e[_][1] = r;
}
inline void ins(int x, int y) {
if (h <= t && q[t][1] >= y)
return;
q[++t][0] = x;
q[t][1] = y;
}
inline int askmin(int x) {
while (h <= t && q[h][1] <= x)
h++;
if (h > t)
return n;
return q[h][0];
}
inline void cal(int lim, int n) {
for (int i = 1; i <= n; i++) {
dp[i] = dp[i - 1];
if (f[i - 1])
dp[i] -= dp[f[i - 1] - 1];
if (i <= lim)
dp[i] += 1;
dp[i] = dp[i] * v[i] + dp[i - 1];
}
}
int solve() {
UnsafeMod::set_mod(P);
for (i = 1; i <= n + n; i++)
umax(f[i], f[i - 1]);
for (i = 1; i <= m; i++)
add(e[i][0], e[i][1]);
m = _;
for (p[0] = i = 1; i <= n; i++)
p[i] = p[i - 1] * 2 % P;
for (i = 0; i <= n; i++)
p[i]--;
is[n] = 1;
for (i = 1; i <= n; i++)
if (is[i])
a[is[i] = ++ca] = i;
for (i = n; i; i--)
if (!is[i])
is[i] = is[i + 1];
n = ca;
for (i = 1; i <= n; i++)
val[i] = p[a[i] - a[i - 1]];
minlen = n, S = 1;
for (i = 1; i <= m; i++) {
x = is[e[i][0]], y = is[e[i][1]];
if (x <= y)
now = y - x + 1;
else
now = y - x + 1 + n;
if (now <= minlen)
minlen = now, S = x;
}
for (i = 1, j = S; i <= n; i++) {
v[i] = val[j];
j++;
if (j > n)
j = 1;
}
en = n;
for (i = 0; i <= n + 1; i++)
f[i] = 0;
for (i = 1; i <= m; i++) {
x = is[e[i][0]], y = is[e[i][1]];
if (y < x)
y += n;
y = y - x;
while (1) {
if (S <= x && x < S + n)
break;
x += n;
}
x -= S - 1;
if (y == n - 1)
x = 1, y = n;
else
y += x;
if (y > n)
y -= n;
if (x <= y) {
umax(f[y], x);
umin(en, y);
} else {
umax(g[y + 1], x);
}
}
for (i = 1; i <= n; i++)
umax(f[i], f[i - 1]);
h = 1, t = 0;
for (i = 1; i <= n; i++) {
now = en;
if (g[i])
ins(i - 1, g[i]);
umin(now, askmin(i));
lim[i] = now;
}
for (i = max(f[n], 1); i <= n; i = j) {
for (j = i; j <= n && lim[i] == lim[j]; j++);
cal(lim[i], j - 1);
ans += dp[j - 1] - dp[i - 1];
}
return ans.get();
}
}
int main() {
read(n);
read(m);
read(ca);
read(cb);
while (m--) {
char ch;
read(x);
readch(ch);
readch(ch);
read(y);
add(x, y);
if (ch == '-')
add(y, x);
}
for (i = 1; i <= ca; i++)
dfs(i);
for (i = ca + 1; i <= ca + cb; i++)
if (vis[i])
id[i] = ++cnt;
else
base = base * 2 % P;
for (i = 1; i <= n; i++)
vis[i] = 0;
for (i = 1; i <= n; i++)
if (!vis[i])
dfs1(i);
for (i = t; i; i--)
if (vis[q[i]]) {
scc++;
st[scc] = cp + 1;
dfs2(q[i]);
en[scc] = cp;
}
for (i = scc; i; i--) {
ce = 0;
for (j = st[i]; j <= en[i]; j++) {
x = pool[j];
if (id[x])
e[++ce] = E(id[x], id[x]);
for (k = g[x]; k; k = nxt[k]) {
y = at[v[k]];
if (y == i)
continue;
if (last[y] == i)
continue;
last[y] = i;
if (f[y].a)
e[++ce] = E(f[y].a, f[y].b);
if (f[y].c)
e[++ce] = E(f[y].c, f[y].d);
}
}
if (!ce)
continue;
sort(e + 1, e + ce + 1, cmp);
x = 0, y = -1;
for (j = 1; j <= ce; j++) {
if (e[j].l > y + 1) {
ext(i, x, y);
x = e[j].l;
}
umax(y, e[j].r);
}
ext(i, x, y);
}
COUNTING::n = cnt;
for (i = 1; i <= ca; i++) {
x = at[i];
if (f[x].a) {
COUNTING::init(f[x].a, f[x].b, f[x].c, f[x].d);
f[x].a = 0;
}
}
base = 1LL * base * COUNTING::solve() % P;
printf("%d", base);
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 1
Accepted
Test #1:
score: 1
Accepted
time: 1ms
memory: 5540kb
input:
2 1 1 1 1 -> 2
output:
1
result:
ok single line: '1'
Test #2:
score: 0
Accepted
time: 3ms
memory: 5508kb
input:
2 1 1 1 2 -- 1
output:
1
result:
ok single line: '1'
Test #3:
score: 0
Accepted
time: 3ms
memory: 5516kb
input:
5 4 1 4 1 -> 2 3 -> 1 1 -- 4 4 -- 5
output:
14
result:
ok single line: '14'
Test #4:
score: 0
Accepted
time: 0ms
memory: 5628kb
input:
15 4 4 4 1 -> 5 2 -> 6 3 -> 7 4 -> 8
output:
1
result:
ok single line: '1'
Test #5:
score: 0
Accepted
time: 3ms
memory: 5500kb
input:
9 10 3 3 1 -> 7 7 -> 2 2 -> 8 8 -> 3 3 -> 9 9 -> 6 1 -> 5 2 -> 5 2 -> 4 3 -> 4
output:
6
result:
ok single line: '6'
Test #6:
score: 0
Accepted
time: 0ms
memory: 5540kb
input:
20 22 6 12 8 -- 9 8 -- 10 13 -- 14 13 -- 15 7 -- 17 2 -> 19 19 -> 16 16 -> 7 4 -> 20 20 -> 8 6 -> 11 11 -> 12 12 -> 13 1 -> 11 4 -> 19 19 -> 12 5 -> 20 20 -> 16 16 -> 13 6 -> 8 8 -> 7 3 -> 19
output:
3948
result:
ok single line: '3948'
Test #7:
score: 0
Accepted
time: 0ms
memory: 5520kb
input:
20 30 5 5 2 -> 1 2 -> 3 4 -> 3 5 -> 4 1 -> 5 6 -> 7 8 -> 7 8 -> 9 9 -> 10 10 -> 6 11 -> 1 13 -> 2 3 -> 15 4 -> 17 5 -> 19 6 -> 12 7 -> 14 8 -> 16 18 -> 9 20 -> 10 12 -> 11 13 -> 12 14 -> 13 15 -> 14 15 -> 16 17 -> 16 17 -> 18 18 -> 19 20 -> 19 20 -> 11
output:
30
result:
ok single line: '30'
Test #8:
score: 0
Accepted
time: 0ms
memory: 5556kb
input:
20 30 5 5 2 -> 1 3 -> 2 4 -> 3 5 -> 4 1 -> 5 7 -> 6 8 -> 7 8 -> 9 10 -> 9 10 -> 6 11 -> 1 2 -> 13 15 -> 3 17 -> 4 5 -> 19 6 -> 12 14 -> 7 16 -> 8 9 -> 18 10 -> 20 11 -> 12 13 -> 12 13 -- 14 14 -> 15 16 -> 15 17 -- 16 18 -- 17 18 -> 19 20 -> 19 11 -> 20
output:
24
result:
ok single line: '24'
Test #9:
score: 0
Accepted
time: 1ms
memory: 5624kb
input:
20 8 1 19 1 -> 2 2 -> 6 6 -> 12 12 -> 19 19 -> 15 15 -> 13 19 -> 20 12 -> 9
output:
522240
result:
ok single line: '522240'
Test #10:
score: 0
Accepted
time: 0ms
memory: 5564kb
input:
20 20 19 1 2 -- 3 9 -- 10 7 -> 8 19 -> 1 13 -> 14 20 -> 6 6 -> 7 4 -> 5 11 -- 10 8 -> 9 14 -- 15 1 -> 2 12 -- 13 18 -- 19 3 -> 4 17 -> 18 16 -> 17 11 -> 12 5 -- 20 15 -> 16
output:
1
result:
ok single line: '1'
Test #11:
score: 0
Accepted
time: 2ms
memory: 5556kb
input:
20 24 10 8 13 -> 12 5 -> 17 6 -> 19 13 -> 14 5 -> 15 9 -> 19 19 -> 17 17 -> 18 19 -> 11 15 -> 16 10 -> 20 1 -> 20 17 -> 16 20 -> 13 2 -> 20 4 -> 15 7 -> 19 20 -> 11 3 -> 20 8 -> 19 11 -> 12 11 -> 18 4 -> 13 15 -> 14
output:
231
result:
ok single line: '231'
Test #12:
score: 0
Accepted
time: 3ms
memory: 5624kb
input:
12 30 3 3 2 -> 1 2 -> 3 1 -> 3 4 -> 5 5 -- 6 6 -> 4 1 -> 7 9 -> 1 1 -- 12 7 -- 2 8 -- 2 2 -> 10 8 -- 3 9 -> 3 11 -> 3 7 -> 4 10 -> 4 12 -- 4 9 -- 5 11 -> 5 5 -> 12 6 -> 8 10 -> 6 6 -> 11 7 -- 10 10 -> 8 11 -> 8 9 -> 11 12 -> 9 7 -> 12
output:
7
result:
ok single line: '7'
Test #13:
score: 0
Accepted
time: 3ms
memory: 5540kb
input:
20 31 5 5 16 -> 10 19 -> 5 5 -- 17 10 -> 6 9 -> 10 20 -> 5 20 -> 3 9 -> 8 4 -> 20 3 -- 11 5 -> 13 1 -- 17 17 -- 6 17 -> 13 18 -- 19 4 -> 3 18 -> 5 2 -> 3 11 -> 10 2 -> 1 11 -- 20 7 -> 8 5 -- 4 18 -> 16 11 -> 16 20 -- 16 6 -- 7 13 -> 19 5 -> 1 6 -- 13 20 -- 18
output:
30
result:
ok single line: '30'
Test #14:
score: 0
Accepted
time: 4ms
memory: 5568kb
input:
20 36 3 4 15 -> 7 8 -> 13 6 -- 5 17 -- 13 12 -> 11 16 -> 15 4 -- 7 2 -- 3 16 -> 1 15 -- 20 12 -> 1 20 -> 5 2 -- 1 8 -> 17 2 -- 11 5 -> 4 9 -> 13 7 -- 1 8 -> 9 12 -- 9 7 -> 16 4 -> 13 5 -> 11 8 -> 1 9 -- 4 1 -- 9 6 -- 20 7 -- 6 2 -- 20 2 -> 15 15 -> 6 3 -> 16 11 -> 20 17 -- 1 1 -- 3 16 -- 2
output:
15
result:
ok single line: '15'
Test #15:
score: 0
Accepted
time: 1ms
memory: 5628kb
input:
20 20 10 10 1 -> 11 1 -> 12 2 -> 12 2 -> 13 3 -> 13 3 -> 14 4 -> 14 4 -> 15 5 -> 15 5 -> 16 6 -> 16 6 -> 17 7 -> 17 7 -> 18 8 -> 18 8 -> 19 9 -> 19 9 -> 20 10 -> 20 10 -> 11
output:
123
result:
ok single line: '123'
Test #16:
score: 0
Accepted
time: 0ms
memory: 5508kb
input:
8 6 4 2 7 -- 2 7 -- 4 8 -> 7 3 -> 8 7 -> 5 1 -> 6
output:
1
result:
ok single line: '1'
Test #17:
score: 0
Accepted
time: 1ms
memory: 5512kb
input:
18 30 3 3 15 -> 16 9 -> 14 18 -> 6 2 -> 9 11 -> 15 13 -> 17 8 -> 11 7 -> 11 17 -> 18 1 -> 8 3 -> 9 14 -> 12 3 -> 7 17 -> 16 13 -> 15 9 -> 13 7 -> 14 12 -> 18 18 -> 5 14 -> 17 12 -> 10 1 -> 7 16 -> 5 16 -> 4 8 -> 13 10 -> 4 11 -> 12 10 -> 6 15 -> 10 2 -> 8
output:
7
result:
ok single line: '7'
Test #18:
score: 0
Accepted
time: 1ms
memory: 5620kb
input:
6 11 3 2 3 -> 2 5 -> 4 5 -> 3 5 -> 1 4 -> 1 6 -> 4 6 -> 2 2 -> 4 6 -> 5 2 -> 5 1 -> 2
output:
3
result:
ok single line: '3'
Test #19:
score: 0
Accepted
time: 3ms
memory: 5500kb
input:
9 12 3 4 5 -> 8 2 -> 5 1 -> 3 1 -> 5 6 -> 2 7 -> 9 4 -> 6 8 -> 3 6 -> 7 8 -> 1 3 -> 4 6 -> 9
output:
15
result:
ok single line: '15'
Test #20:
score: 0
Accepted
time: 1ms
memory: 5516kb
input:
10 6 3 7 5 -- 6 3 -- 10 1 -> 4 2 -> 5 2 -> 4 3 -> 5
output:
56
result:
ok single line: '56'
Test #21:
score: 0
Accepted
time: 4ms
memory: 5556kb
input:
5 5 2 3 1 -> 5 2 -> 5 3 -> 1 5 -> 4 2 -> 1
output:
6
result:
ok single line: '6'
Test #22:
score: 0
Accepted
time: 0ms
memory: 5624kb
input:
11 10 3 5 10 -> 5 3 -> 1 10 -> 4 2 -> 3 2 -> 7 10 -> 11 9 -> 10 1 -> 10 6 -> 7 3 -> 5
output:
24
result:
ok single line: '24'
Test #23:
score: 0
Accepted
time: 4ms
memory: 5504kb
input:
20 20 8 12 12 -- 13 16 -- 17 16 -- 18 19 -- 20 1 -> 11 11 -> 12 12 -> 14 14 -> 15 15 -> 16 16 -> 19 7 -> 9 8 -> 10 1 -> 10 10 -> 9 2 -> 11 3 -> 12 4 -> 14 5 -> 15 6 -> 16 7 -> 19
output:
2752
result:
ok single line: '2752'
Subtask #2:
score: 1
Accepted
Test #24:
score: 1
Accepted
time: 1ms
memory: 5564kb
input:
200 360 20 20 104 -> 180 182 -> 21 136 -> 115 159 -> 139 66 -> 26 153 -> 154 189 -> 79 187 -> 143 42 -> 161 144 -> 188 165 -> 61 144 -> 117 10 -> 173 48 -> 111 180 -> 166 191 -> 138 141 -> 108 84 -> 47 156 -> 66 116 -> 74 119 -> 123 200 -> 128 91 -> 154 83 -> 70 64 -> 50 82 -> 146 152 -> 91 45 -> 64...
output:
1038335
result:
ok single line: '1038335'
Test #25:
score: 0
Accepted
time: 3ms
memory: 5564kb
input:
200 300 50 50 42 -> 137 189 -> 63 198 -> 199 113 -> 122 152 -> 169 188 -> 195 168 -> 196 10 -> 116 120 -> 59 117 -> 164 149 -> 75 22 -> 113 102 -> 75 126 -> 161 14 -> 128 158 -> 133 11 -> 156 152 -> 127 26 -> 109 104 -> 100 29 -> 136 158 -> 141 137 -> 125 148 -> 88 128 -> 104 9 -> 180 156 -> 186 21 ...
output:
983378722
result:
ok single line: '983378722'
Test #26:
score: 0
Accepted
time: 3ms
memory: 5548kb
input:
200 499 51 49 198 -> 100 117 -> 122 86 -> 85 27 -> 28 117 -- 185 87 -> 86 120 -- 114 191 -> 167 59 -> 60 28 -> 189 139 -- 151 160 -> 113 170 -- 102 122 -> 85 175 -- 123 87 -> 88 132 -> 164 186 -> 97 100 -> 186 126 -- 142 174 -- 168 137 -> 154 98 -- 186 142 -> 68 168 -> 117 187 -> 152 87 -> 89 148 ->...
output:
949480667
result:
ok single line: '949480667'
Test #27:
score: 0
Accepted
time: 1ms
memory: 5520kb
input:
200 484 51 63 116 -> 161 21 -> 22 10 -> 192 42 -> 183 146 -> 86 185 -> 194 136 -> 1 145 -> 131 180 -> 58 89 -> 90 151 -> 84 128 -> 190 1 -> 152 92 -> 91 174 -> 135 156 -> 151 162 -> 115 197 -> 47 26 -> 25 50 -> 1 93 -> 94 71 -> 72 76 -> 77 16 -> 15 79 -> 80 4 -> 5 139 -> 141 29 -> 31 69 -- 144 49 ->...
output:
99548853
result:
ok single line: '99548853'
Test #28:
score: 0
Accepted
time: 1ms
memory: 5556kb
input:
200 142 69 131 152 -> 154 119 -> 121 24 -- 25 151 -- 10 35 -> 88 90 -> 93 87 -- 86 118 -- 117 29 -> 78 84 -- 85 13 -- 166 93 -- 40 77 -- 29 58 -- 57 48 -- 103 114 -- 60 66 -- 67 37 -> 38 42 -- 43 117 -- 60 171 -- 15 64 -- 63 38 -- 39 34 -- 33 40 -- 95 71 -> 73 107 -> 49 148 -> 151 139 -> 8 41 -> 42 ...
output:
102959076
result:
ok single line: '102959076'
Test #29:
score: 0
Accepted
time: 4ms
memory: 5568kb
input:
200 210 105 15 5 -- 121 4 -- 122 122 -> 121 8 -- 123 19 -- 123 23 -- 123 7 -- 124 6 -> 125 125 -> 124 124 -> 123 11 -- 126 10 -- 127 9 -> 128 128 -> 127 127 -> 126 13 -- 129 16 -- 129 12 -> 130 130 -> 129 14 -- 131 15 -- 132 132 -> 131 131 -> 129 17 -- 133 18 -> 134 134 -> 133 133 -> 129 129 -> 126 ...
output:
10584
result:
ok single line: '10584'
Test #30:
score: 0
Accepted
time: 0ms
memory: 5560kb
input:
199 318 50 28 62 -> 61 39 -> 80 143 -> 163 152 -> 184 5 -> 104 48 -> 153 178 -> 96 177 -> 144 85 -> 110 122 -> 158 121 -> 54 94 -> 98 132 -> 128 169 -> 190 102 -> 57 86 -> 58 176 -> 71 189 -> 197 68 -> 69 132 -> 113 29 -> 117 60 -> 59 161 -> 112 40 -> 80 74 -> 73 110 -> 102 135 -> 181 146 -> 136 79 ...
output:
259738311
result:
ok single line: '259738311'
Test #31:
score: 0
Accepted
time: 3ms
memory: 5576kb
input:
199 343 25 34 144 -> 186 16 -> 172 185 -> 119 55 -- 56 128 -> 96 184 -> 144 184 -> 111 197 -> 194 114 -> 185 190 -> 132 3 -> 176 199 -> 189 132 -> 152 138 -> 48 79 -> 165 127 -> 122 13 -> 98 115 -> 146 69 -> 136 189 -> 32 44 -> 42 117 -> 102 144 -> 123 61 -> 104 19 -> 193 76 -> 170 95 -> 121 176 -> ...
output:
177200520
result:
ok single line: '177200520'
Test #32:
score: 0
Accepted
time: 3ms
memory: 5540kb
input:
200 326 41 39 95 -> 127 193 -> 166 159 -> 97 14 -> 167 144 -> 90 41 -> 153 119 -> 111 77 -> 75 135 -> 189 116 -> 169 99 -> 162 192 -> 86 170 -> 160 10 -> 153 165 -> 87 126 -> 156 163 -> 83 72 -> 73 74 -> 75 195 -> 124 102 -> 123 104 -> 138 6 -> 153 135 -> 183 39 -> 130 51 -> 50 196 -> 164 21 -> 103 ...
output:
755794076
result:
ok single line: '755794076'
Test #33:
score: 0
Accepted
time: 4ms
memory: 5592kb
input:
196 308 42 47 142 -> 170 136 -> 177 44 -- 45 137 -> 151 83 -> 84 36 -> 127 168 -> 57 112 -> 128 187 -> 52 102 -> 155 147 -> 157 42 -> 186 96 -> 129 27 -> 110 112 -> 92 56 -- 54 70 -> 68 18 -> 194 195 -> 128 172 -> 140 8 -> 163 46 -- 47 172 -> 145 12 -> 180 186 -> 105 99 -> 151 149 -> 125 103 -> 95 1...
output:
486055864
result:
ok single line: '486055864'
Test #34:
score: 0
Accepted
time: 3ms
memory: 5636kb
input:
199 196 153 43 197 -> 186 64 -> 197 123 -> 198 117 -> 198 52 -> 197 199 -> 178 198 -> 161 199 -> 176 31 -> 199 59 -> 197 44 -> 197 21 -> 199 51 -> 197 121 -> 198 199 -> 183 2 -> 199 57 -> 197 197 -> 196 25 -> 199 8 -> 199 86 -> 198 36 -> 197 149 -> 199 66 -> 197 67 -> 197 142 -> 199 199 -> 182 82 ->...
output:
542926224
result:
ok single line: '542926224'
Test #35:
score: 0
Accepted
time: 3ms
memory: 5556kb
input:
194 250 55 61 61 -- 62 61 -- 63 64 -- 65 66 -- 67 71 -- 72 73 -- 74 76 -- 77 78 -- 79 78 -- 80 85 -- 86 85 -- 87 85 -- 88 89 -- 90 91 -- 92 93 -- 94 93 -- 95 102 -- 103 102 -- 104 102 -- 105 107 -- 108 107 -- 109 111 -- 112 111 -- 113 6 -> 121 121 -> 120 120 -> 119 119 -> 118 118 -> 117 117 -> 59 8 ...
output:
886436262
result:
ok single line: '886436262'
Test #36:
score: 0
Accepted
time: 3ms
memory: 5576kb
input:
195 235 60 80 62 -- 63 66 -- 67 71 -- 72 73 -- 76 79 -- 80 83 -- 84 85 -- 86 87 -- 88 87 -- 89 87 -- 90 87 -- 91 92 -- 93 92 -- 94 96 -- 97 96 -- 98 96 -- 99 100 -- 101 104 -- 105 104 -- 109 111 -- 112 117 -- 118 122 -- 123 125 -- 126 130 -- 131 130 -- 132 130 -- 133 130 -- 134 130 -- 135 137 -- 138...
output:
752176841
result:
ok single line: '752176841'
Test #37:
score: 0
Accepted
time: 1ms
memory: 5564kb
input:
200 240 100 60 195 -> 114 162 -> 116 15 -> 171 31 -> 130 90 -> 160 81 -> 160 102 -> 101 27 -> 127 177 -> 106 55 -> 172 132 -> 131 174 -> 179 128 -> 127 141 -> 140 196 -> 111 127 -> 126 53 -> 168 3 -> 163 183 -> 168 21 -> 181 176 -> 178 185 -> 199 158 -> 157 92 -> 160 67 -> 179 73 -> 153 70 -> 176 16...
output:
780652002
result:
ok single line: '780652002'
Test #38:
score: 0
Accepted
time: 0ms
memory: 5560kb
input:
200 592 4 4 193 -> 143 198 -> 46 14 -> 22 109 -> 47 120 -> 132 45 -> 155 33 -> 133 33 -> 114 74 -> 125 53 -> 160 121 -> 87 134 -> 168 13 -> 156 26 -> 104 145 -> 52 72 -> 35 178 -> 65 151 -> 190 171 -> 17 52 -> 12 184 -> 130 85 -> 200 176 -> 88 46 -> 91 56 -> 137 149 -> 187 13 -> 163 186 -> 105 65 ->...
output:
15
result:
ok single line: '15'
Test #39:
score: 0
Accepted
time: 3ms
memory: 5580kb
input:
200 200 7 193 8 -- 9 8 -- 10 8 -- 11 8 -- 12 8 -- 13 8 -- 14 8 -- 15 8 -- 16 8 -- 17 8 -- 18 8 -- 19 8 -- 20 8 -- 21 8 -- 22 8 -- 23 8 -- 24 8 -- 25 8 -- 26 8 -- 27 8 -- 28 8 -- 29 8 -- 30 8 -- 31 8 -- 32 8 -- 33 8 -- 34 8 -- 35 36 -- 37 36 -- 38 36 -- 39 36 -- 40 36 -- 41 36 -- 42 36 -- 43 36 -- 44...
output:
714723034
result:
ok single line: '714723034'
Subtask #3:
score: 1
Accepted
Test #40:
score: 1
Accepted
time: 1ms
memory: 5768kb
input:
3000 8028 401 433 1220 -- 1460 1170 -> 2617 975 -> 2172 2360 -> 2457 1940 -- 2222 1250 -> 2269 687 -> 686 198 -- 201 288 -> 1236 2899 -> 1548 1238 -- 2495 1585 -> 2511 2032 -- 1211 1229 -- 2232 1086 -- 2055 1270 -- 2827 1311 -> 792 385 -> 384 2933 -- 2598 2100 -> 962 2553 -> 1717 1217 -> 1516 1284 -...
output:
253229893
result:
ok single line: '253229893'
Test #41:
score: 0
Accepted
time: 5ms
memory: 5872kb
input:
2996 4194 1000 798 857 -> 2397 341 -> 2015 595 -> 2875 391 -> 2015 590 -> 2300 1860 -> 1862 2711 -> 2216 1905 -> 1155 2683 -> 2698 245 -> 2490 23 -> 2732 109 -> 2601 2598 -> 2379 441 -> 2693 2349 -> 1703 1825 -> 2009 1501 -> 1500 2727 -> 2119 654 -> 2664 640 -> 2258 2032 -> 2327 488 -> 2126 170 -> 1...
output:
130634365
result:
ok single line: '130634365'
Test #42:
score: 0
Accepted
time: 0ms
memory: 6056kb
input:
5000 6000 2000 2000 4677 -> 4960 2145 -> 2144 1216 -> 2785 4372 -> 2328 2825 -> 2824 2429 -> 2428 3549 -> 3548 4178 -> 4985 4723 -> 2187 4023 -> 4571 1864 -> 4226 2191 -> 2190 4888 -> 2093 4917 -> 3117 4400 -> 4044 3838 -> 3837 627 -> 4609 459 -> 3542 2586 -> 2585 1774 -> 4144 789 -> 4369 1058 -> 29...
output:
793410203
result:
ok single line: '793410203'
Test #43:
score: 0
Accepted
time: 5ms
memory: 5920kb
input:
4999 8475 2048 2333 4916 -> 4154 2007 -> 2008 4387 -> 4418 4651 -> 3420 4521 -> 4196 2812 -> 2810 1493 -> 1491 3658 -> 3659 3578 -> 3579 3718 -> 3720 2670 -> 2666 1199 -> 1200 2385 -> 2388 2410 -> 2406 1989 -> 1986 3403 -> 3402 2587 -> 2586 3108 -> 3107 3586 -> 3589 562 -> 563 1065 -> 1066 3734 -> 3...
output:
957931503
result:
ok single line: '957931503'
Test #44:
score: 0
Accepted
time: 0ms
memory: 6032kb
input:
5000 10000 2500 2500 4154 -> 4153 25 -> 4418 1643 -> 3536 4020 -> 4019 4991 -> 4992 1084 -> 2976 1717 -> 1718 1584 -> 3476 4752 -> 4753 4031 -> 4032 2389 -> 4282 630 -> 2522 3937 -> 3936 1612 -> 3504 4472 -> 4473 1520 -> 1519 4210 -> 4211 4617 -> 4616 1000 -> 2893 2107 -> 4000 348 -> 4741 1640 -> 35...
output:
917179159
result:
ok single line: '917179159'
Test #45:
score: 0
Accepted
time: 4ms
memory: 5940kb
input:
4973 6668 1500 1777 2922 -- 2910 3764 -> 3417 4949 -> 3975 4663 -> 1993 4182 -> 3418 3470 -> 4659 2124 -- 2130 2070 -- 2071 1355 -> 4407 4008 -> 4599 4356 -> 4425 4889 -> 4396 4707 -> 3717 3593 -> 1692 948 -> 4138 867 -> 3804 1297 -> 4853 4425 -> 3849 1742 -- 1741 3756 -> 4097 4895 -> 4263 3391 -> 4...
output:
239020875
result:
ok single line: '239020875'
Test #46:
score: 0
Accepted
time: 0ms
memory: 5924kb
input:
4923 5789 2137 1918 2188 -- 2192 3546 -- 3562 3525 -> 3533 3913 -> 3918 974 -> 4514 4730 -> 2511 399 -> 2143 1107 -> 4843 4285 -> 4073 4507 -> 2608 3796 -- 3797 1870 -> 4299 1214 -> 4519 1228 -> 4219 4127 -> 4597 3216 -- 3212 4681 -> 3563 4317 -> 4348 2033 -> 4818 1544 -> 4170 2301 -- 2294 955 -> 46...
output:
227337116
result:
ok single line: '227337116'
Test #47:
score: 0
Accepted
time: 0ms
memory: 5916kb
input:
5000 4664 2616 2384 4573 -> 4574 554 -> 555 1371 -> 1372 1620 -> 1621 2179 -> 2180 4486 -> 2090 577 -> 3096 529 -> 530 4841 -- 2508 1908 -> 1909 816 -> 817 1945 -> 1946 445 -> 446 2681 -> 2682 2390 -> 4732 3830 -> 3831 1246 -> 1247 2457 -> 2458 4740 -> 2401 3768 -- 1275 1180 -> 1181 1678 -> 1679 101...
output:
486858746
result:
ok single line: '486858746'
Test #48:
score: 0
Accepted
time: 5ms
memory: 5904kb
input:
4992 9280 360 394 1391 -> 3767 3968 -> 1840 4750 -> 684 4441 -> 2864 2607 -> 1395 2356 -> 4854 3967 -> 999 1988 -> 3005 1302 -> 407 1501 -> 4429 2829 -> 3882 4934 -> 4336 1898 -> 3784 3815 -> 1235 2646 -> 3847 4424 -> 2190 189 -> 4700 2250 -> 2659 3397 -> 3554 936 -> 2472 77 -> 3739 2797 -> 3414 229...
output:
464113563
result:
ok single line: '464113563'
Test #49:
score: 0
Accepted
time: 0ms
memory: 5648kb
input:
5000 9 2 4444 1 -> 5 7 -> 1 1 -- 9 1 -> 11 2 -> 11 2 -> 13 15 -> 2 17 -- 2 2 -> 5
output:
371505583
result:
ok single line: '371505583'
Test #50:
score: 0
Accepted
time: 5ms
memory: 6028kb
input:
4990 6830 1500 1802 3344 -> 1744 4947 -> 4431 1379 -> 4906 686 -> 4711 3593 -> 4742 3360 -> 2350 244 -> 3711 387 -> 4394 952 -> 3405 109 -> 4481 291 -> 3910 4682 -> 3087 1112 -> 3415 3810 -> 3512 1837 -> 1838 569 -> 3845 4856 -> 4121 3988 -> 4840 4656 -> 1738 4407 -> 2677 782 -> 3551 2407 -> 2408 39...
output:
53767981
result:
ok single line: '53767981'
Test #51:
score: 0
Accepted
time: 0ms
memory: 5876kb
input:
5000 5000 30 4970 31 -- 32 31 -- 33 31 -- 34 31 -- 35 31 -- 36 31 -- 37 31 -- 38 31 -- 39 31 -- 40 31 -- 41 31 -- 42 31 -- 43 31 -- 44 31 -- 45 31 -- 46 31 -- 47 31 -- 48 31 -- 49 31 -- 50 31 -- 51 31 -- 52 31 -- 53 31 -- 54 31 -- 55 31 -- 56 31 -- 57 31 -- 58 31 -- 59 31 -- 60 31 -- 61 31 -- 62 31 ...
output:
732610805
result:
ok single line: '732610805'
Subtask #4:
score: 1
Accepted
Test #52:
score: 1
Accepted
time: 338ms
memory: 43724kb
input:
482822 959624 2998 2999 295169 -> 25482 351106 -> 358911 94543 -> 291620 203491 -> 138533 455060 -> 118484 38644 -> 429232 271166 -> 408392 310839 -> 332732 308961 -> 448115 192668 -> 403132 367072 -> 390997 355638 -> 305571 478714 -> 426285 126806 -> 322693 471322 -> 163762 145598 -> 66308 348342 -...
output:
111100790
result:
ok single line: '111100790'
Test #53:
score: 0
Accepted
time: 386ms
memory: 43924kb
input:
484978 963974 3000 3000 141769 -> 234828 260927 -> 218970 236983 -> 433297 227234 -> 397153 309565 -> 366087 112150 -> 166912 227466 -> 413340 105904 -> 375216 124343 -> 451410 74400 -> 53240 100101 -> 190422 29034 -> 423832 362388 -> 28298 283096 -> 260332 360764 -> 317553 73503 -> 8849 430967 -> 1...
output:
17429083
result:
ok single line: '17429083'
Test #54:
score: 0
Accepted
time: 387ms
memory: 44836kb
input:
496288 986673 2919 2955 25981 -> 411032 366907 -> 157675 197876 -> 406441 186542 -> 386445 326871 -> 203549 482579 -> 307434 478390 -> 251919 6154 -> 162436 359832 -> 298179 131908 -> 203655 51902 -> 38641 59386 -> 130790 154499 -> 92834 183024 -> 30476 335018 -> 313082 493205 -> 123725 270035 -> 21...
output:
851532352
result:
ok single line: '851532352'
Test #55:
score: 0
Accepted
time: 334ms
memory: 38572kb
input:
417762 831185 2019 2222 296328 -> 10491 321848 -> 381425 203677 -> 48748 215429 -> 77495 242641 -> 89410 310711 -> 205583 42323 -> 143772 205756 -> 339510 39324 -> 94146 355268 -> 181378 387359 -> 48761 214253 -> 72846 154697 -> 352153 241830 -> 229117 107611 -> 321082 203017 -> 72495 172855 -> 2259...
output:
76363246
result:
ok single line: '76363246'
Test #56:
score: 0
Accepted
time: 373ms
memory: 44920kb
input:
498361 992121 2333 2149 4943 -> 440373 318575 -> 202142 74514 -> 75114 377318 -> 307815 151876 -> 447493 493771 -> 142033 309125 -> 269827 351821 -> 197691 179311 -> 237378 281334 -> 221469 82226 -> 437101 147759 -> 194431 92421 -> 155832 165541 -> 262685 61525 -> 421896 48523 -> 417068 241519 -> 28...
output:
543320499
result:
ok single line: '543320499'
Test #57:
score: 0
Accepted
time: 276ms
memory: 35604kb
input:
380185 755803 1693 3000 70077 -> 240501 280229 -> 378190 294133 -> 300954 326283 -> 197649 224178 -> 13718 128112 -> 168290 201313 -> 164129 275592 -> 173651 344857 -> 265347 356698 -> 202212 372595 -> 187684 69126 -> 231807 16764 -> 327246 52719 -> 96866 117914 -> 143661 238887 -> 286402 112814 -> ...
output:
678846323
result:
ok single line: '678846323'
Subtask #5:
score: 1
Accepted
Test #58:
score: 1
Accepted
time: 279ms
memory: 35160kb
input:
324219 964928 3000 2999 225338 -> 99336 238630 -> 81437 15635 -> 212723 28808 -> 66657 155734 -> 159393 21200 -> 169542 166398 -> 212810 49801 -> 59110 225342 -- 33239 103624 -> 282192 310894 -> 106042 82787 -> 45950 78852 -> 323358 110462 -> 271102 43363 -> 128811 288100 -> 96678 256048 -> 210282 1...
output:
961630822
result:
ok single line: '961630822'
Test #59:
score: 0
Accepted
time: 280ms
memory: 36140kb
input:
335915 999997 3000 3000 141647 -> 248728 312284 -> 164046 246489 -> 160827 176634 -> 61814 131672 -> 259268 99109 -> 202553 30505 -> 320311 88121 -> 143536 12020 -> 157399 285428 -> 51331 99433 -> 38255 316725 -> 281535 92861 -> 223126 176662 -> 333783 56322 -> 147032 9058 -> 217213 112326 -> 254017...
output:
89141898
result:
ok single line: '89141898'
Test #60:
score: 0
Accepted
time: 344ms
memory: 44944kb
input:
498000 990000 3000 3000 320086 -> 224040 221015 -> 423374 216797 -> 244608 116304 -> 267655 74252 -> 454775 251028 -> 486728 450965 -> 243202 186182 -> 306835 165303 -> 98355 338021 -> 336805 210191 -> 488691 112335 -> 218451 204782 -> 318328 350908 -> 85565 29841 -> 456370 411072 -> 30814 184962 ->...
output:
779066732
result:
ok single line: '779066732'
Test #61:
score: 0
Accepted
time: 303ms
memory: 37304kb
input:
335328 999996 2994 2994 287254 -> 328340 188470 -> 158916 300591 -> 223951 194093 -> 267531 268885 -> 286374 109976 -> 151609 71461 -> 266471 173387 -> 219819 61690 -> 60920 68864 -> 332899 72682 -> 204279 281472 -> 260132 169574 -> 69120 229040 -> 263364 245379 -> 21955 292360 -> 123203 269208 -> 1...
output:
445699418
result:
ok single line: '445699418'
Test #62:
score: 0
Accepted
time: 220ms
memory: 32212kb
input:
336724 667500 3000 2995 242196 -> 142725 12948 -> 18459 263335 -> 91844 284636 -> 259298 42235 -> 142504 1720 -> 282545 47603 -> 248538 22229 -> 231359 18117 -> 286187 71035 -> 312020 233316 -> 155140 58979 -> 150002 51072 -> 191933 235094 -> 66873 48438 -> 227929 31494 -> 163988 142900 -> 256484 18...
output:
859446722
result:
ok single line: '859446722'
Test #63:
score: 0
Accepted
time: 396ms
memory: 44932kb
input:
497315 989681 2998 2468 256141 -> 220726 442413 -> 384445 380176 -> 258002 323593 -> 286614 360478 -> 203175 382686 -> 184775 176310 -> 209687 84031 -> 409056 155136 -> 91889 370868 -> 256754 159592 -> 250915 67496 -> 181032 419043 -> 378501 189997 -> 362007 159897 -> 285667 357699 -> 91293 6866 -> ...
output:
99765246
result:
ok single line: '99765246'
Test #64:
score: 0
Accepted
time: 120ms
memory: 39256kb
input:
426235 846260 3000 2897 3006 -- 3007 3010 -- 3011 3026 -- 3027 3028 -- 3029 3032 -- 3033 3032 -- 3034 3035 -- 3036 3038 -- 3039 3038 -- 3040 3043 -- 3044 3046 -- 3047 3048 -- 3049 3052 -- 3053 3052 -- 3054 3052 -- 3055 3057 -- 3058 3063 -- 3064 3065 -- 3066 3065 -- 3067 3068 -- 3069 3068 -- 3070 306...
output:
632855874
result:
ok single line: '632855874'
Test #65:
score: 0
Accepted
time: 407ms
memory: 45224kb
input:
500000 994000 3000 3000 423863 -> 166344 345305 -> 168235 379618 -> 259302 147090 -> 137936 286046 -> 187488 442926 -> 291256 30938 -> 122467 313124 -> 197522 427910 -> 66884 202831 -> 481101 269202 -> 436363 220430 -> 405699 358256 -> 349844 54089 -> 363863 40418 -> 96892 113659 -> 449289 230667 ->...
output:
454492490
result:
ok single line: '454492490'
Test #66:
score: 0
Accepted
time: 5ms
memory: 5916kb
input:
4500 4500 1500 3000 1502 -- 1503 1502 -- 1504 1506 -- 1507 1509 -- 1510 1509 -- 1511 1509 -- 1512 1513 -- 1514 1513 -- 1515 1517 -- 1518 1520 -- 1521 1522 -- 1523 1524 -- 1525 1524 -- 1526 1527 -- 1528 1529 -- 1530 1529 -- 1531 1533 -- 1534 1533 -- 1535 1536 -- 1537 1536 -- 1538 1539 -- 1540 1541 --...
output:
254902877
result:
ok single line: '254902877'
Test #67:
score: 0
Accepted
time: 1ms
memory: 5784kb
input:
3000 3000 20 2980 21 -- 22 21 -- 23 21 -- 24 21 -- 25 21 -- 26 21 -- 27 21 -- 28 21 -- 29 21 -- 30 21 -- 31 21 -- 32 21 -- 33 21 -- 34 21 -- 35 21 -- 36 21 -- 37 21 -- 38 21 -- 39 21 -- 40 21 -- 41 21 -- 42 21 -- 43 21 -- 44 21 -- 45 21 -- 46 21 -- 47 21 -- 48 21 -- 49 21 -- 50 21 -- 51 21 -- 52 21 ...
output:
115775179
result:
ok single line: '115775179'
Subtask #6:
score: 1
Accepted
Test #68:
score: 1
Accepted
time: 15ms
memory: 14080kb
input:
100000 120000 40000 40000 64472 -> 64471 89344 -> 63610 47220 -> 47219 58030 -> 58029 8635 -> 98063 84959 -> 69963 81331 -> 69822 50779 -> 50778 10707 -> 50707 79454 -> 79453 89874 -> 44613 95442 -> 99600 1436 -> 87147 70359 -> 70358 83184 -> 95508 37154 -> 77154 83277 -> 42911 21371 -> 99760 50687 ...
output:
390851237
result:
ok single line: '390851237'
Test #69:
score: 0
Accepted
time: 17ms
memory: 14032kb
input:
100000 129998 40000 30000 87965 -> 89030 84339 -> 59102 25830 -> 96999 44772 -> 44771 79956 -> 69883 85188 -> 72355 67549 -> 67548 94900 -> 47080 1891 -> 70000 64126 -> 64125 89336 -> 83726 86298 -> 51667 25873 -> 72406 89560 -> 48041 72955 -> 80369 8727 -> 83118 49673 -> 49672 73465 -> 68293 44574 ...
output:
85201980
result:
ok single line: '85201980'
Test #70:
score: 0
Accepted
time: 42ms
memory: 15144kb
input:
99999 233331 33333 33333 86572 -> 83970 22577 -> 88395 31395 -> 31396 17804 -> 73548 26260 -> 76907 24871 -> 82282 87760 -> 45096 39940 -> 39939 15306 -> 15305 96508 -> 63213 9574 -> 9573 9969 -> 88462 15976 -> 87850 88318 -> 95886 76805 -> 95153 81936 -> 92928 37262 -> 37263 9960 -> 76381 43674 -> ...
output:
425200218
result:
ok single line: '425200218'
Test #71:
score: 0
Accepted
time: 21ms
memory: 12952kb
input:
99999 154599 44841 560 60511 -> 55307 53485 -> 68173 33079 -> 67957 19061 -> 76023 82802 -> 87612 65232 -> 59075 73350 -> 82750 80360 -> 50532 77036 -> 68053 78232 -> 55136 58301 -> 71355 38163 -> 78168 20776 -> 94296 82128 -> 48788 4325 -> 52963 52168 -> 61991 45865 -> 85434 34907 -> 52586 89475 ->...
output:
850170958
result:
ok single line: '850170958'
Test #72:
score: 0
Accepted
time: 29ms
memory: 13412kb
input:
99976 138415 40000 25626 13411 -> 95581 73011 -> 91658 78736 -> 91939 80810 -> 43499 70227 -> 78306 30183 -> 82183 66604 -> 40157 94452 -> 65770 72973 -> 69724 65251 -> 65252 95610 -> 48069 49699 -> 49700 7317 -> 76016 86626 -> 67042 89177 -> 98426 97591 -> 79940 25824 -> 92638 82687 -> 96207 92681 ...
output:
919815863
result:
ok single line: '919815863'
Test #73:
score: 0
Accepted
time: 14ms
memory: 11600kb
input:
99639 99839 58700 300 187 -- 59001 225 -- 59001 232 -- 59001 319 -- 59001 180 -- 59002 183 -- 59002 186 -- 59002 169 -- 59003 171 -- 59003 172 -- 59003 175 -- 59003 178 -- 59003 170 -> 59004 59004 -> 59003 174 -- 59005 173 -- 59006 59006 -> 59005 59005 -> 59003 177 -- 59007 176 -> 59008 59008 -> 590...
output:
291285700
result:
ok single line: '291285700'
Test #74:
score: 0
Accepted
time: 14ms
memory: 13312kb
input:
98917 191154 5000 1061 5002 -- 5003 5013 -- 5014 5013 -- 5015 5017 -- 5018 5025 -- 5026 5057 -- 5058 5073 -- 5074 5088 -- 5089 5096 -- 5097 5099 -- 5100 5109 -- 5110 5112 -- 5113 5119 -- 5120 5130 -- 5131 5146 -- 5147 5149 -- 5150 5155 -- 5156 5158 -- 5159 5169 -- 5170 5169 -- 5171 5182 -- 5183 5188...
output:
662800219
result:
ok single line: '662800219'
Test #75:
score: 0
Accepted
time: 35ms
memory: 13536kb
input:
99172 144578 25000 32166 96256 -> 48263 77488 -> 79613 24405 -> 71264 72873 -> 86353 88783 -> 51562 97415 -> 34584 21873 -> 96989 10368 -> 69641 6107 -> 80482 64529 -> 36275 74421 -> 36715 80739 -> 76266 15564 -> 80496 80461 -> 51839 6263 -> 63029 22496 -> 63733 78142 -> 73225 16201 -> 81930 53088 -...
output:
428108577
result:
ok single line: '428108577'
Test #76:
score: 0
Accepted
time: 15ms
memory: 12772kb
input:
100000 100000 300 99700 301 -- 302 301 -- 303 301 -- 304 301 -- 305 301 -- 306 301 -- 307 301 -- 308 301 -- 309 301 -- 310 301 -- 311 301 -- 312 301 -- 313 301 -- 314 301 -- 315 301 -- 316 301 -- 317 301 -- 318 301 -- 319 301 -- 320 301 -- 321 301 -- 322 301 -- 323 301 -- 324 301 -- 325 301 -- 326 3...
output:
473235705
result:
ok single line: '473235705'
Subtask #7:
score: 1
Accepted
Test #77:
score: 1
Accepted
time: 36ms
memory: 22120kb
input:
195000 240000 75000 75000 163326 -> 173398 177679 -> 167910 57236 -> 168189 108808 -> 108807 172327 -> 151104 185166 -> 177133 174476 -> 79690 153939 -> 94296 42741 -> 186113 48452 -> 154363 167925 -> 174849 53978 -> 182387 45368 -> 180772 17460 -> 187836 181176 -> 166147 132059 -> 132058 132006 -> ...
output:
422670064
result:
ok single line: '422670064'
Test #78:
score: 0
Accepted
time: 68ms
memory: 24372kb
input:
216414 282828 75000 75000 78048 -> 78047 203753 -> 119484 95024 -> 95023 150539 -> 153542 115725 -> 115724 80200 -> 80199 13599 -> 168633 65876 -> 208240 187436 -> 143513 135612 -> 135611 63145 -> 170913 113932 -> 113931 196413 -> 126872 30164 -> 215464 110884 -> 110883 68393 -> 153132 209480 -> 962...
output:
520667174
result:
ok single line: '520667174'
Test #79:
score: 0
Accepted
time: 88ms
memory: 28888kb
input:
274998 399996 75000 75000 174803 -> 95346 37543 -> 176190 137781 -> 137780 264648 -> 207656 188178 -> 263545 250371 -> 170251 264382 -> 239795 226461 -> 113490 117297 -> 117296 11750 -> 222383 158450 -> 274095 95847 -> 95846 185363 -> 110191 91468 -> 91467 16403 -> 250638 102797 -> 102796 48818 -> 2...
output:
495690226
result:
ok single line: '495690226'
Test #80:
score: 0
Accepted
time: 257ms
memory: 45064kb
input:
499996 857136 71428 71428 283356 -> 138641 183828 -> 344461 222272 -> 212366 293886 -> 472552 230836 -> 129808 18002 -> 466804 394165 -> 280521 349530 -> 109763 351442 -> 144054 339692 -> 378190 345610 -> 430486 215199 -> 486632 179854 -> 497041 44820 -> 407807 343987 -> 185277 179173 -> 409634 4751...
output:
817816516
result:
ok single line: '817816516'
Test #81:
score: 0
Accepted
time: 291ms
memory: 41080kb
input:
375000 975000 75000 75000 303139 -> 200471 345193 -> 105416 66048 -> 284058 198185 -> 180133 154480 -> 287812 231604 -> 141362 316289 -> 162982 310319 -> 146916 57410 -> 57409 157027 -> 370327 58412 -> 58411 261750 -> 336447 226662 -> 131180 238456 -> 226181 103975 -> 103974 267833 -> 174605 54607 -...
output:
482293884
result:
ok single line: '482293884'
Test #82:
score: 0
Accepted
time: 347ms
memory: 44724kb
input:
499903 897417 75000 30578 415581 -> 348575 490527 -> 342253 237685 -> 406602 393879 -> 179240 14785 -> 304482 129408 -> 197621 447042 -> 131957 205276 -> 347740 298672 -> 209960 74507 -> 215057 488440 -> 161707 381405 -> 218089 161101 -> 267700 342191 -> 90711 489575 -> 263088 490822 -> 122217 33058...
output:
861407009
result:
ok single line: '861407009'
Test #83:
score: 0
Accepted
time: 349ms
memory: 44952kb
input:
499916 887906 75000 43110 328269 -> 293403 438222 -> 317206 52157 -> 131628 329342 -> 137950 179641 -> 415616 216239 -> 230494 313782 -> 307492 242755 -> 330644 325894 -> 170339 445256 -> 436260 427290 -> 82721 466453 -> 290095 311389 -> 372912 84845 -> 84846 361150 -> 300259 254805 -> 121136 493328...
output:
669202168
result:
ok single line: '669202168'
Test #84:
score: 0
Accepted
time: 348ms
memory: 44704kb
input:
499270 862441 75000 54756 386858 -> 240291 263704 -> 482220 189495 -> 78062 346890 -> 295667 207090 -> 116080 6986 -> 139384 284241 -> 110451 486268 -> 355990 380628 -> 401915 41602 -> 353359 468348 -> 362313 311091 -> 370322 180684 -> 201200 205522 -> 126978 198234 -> 180574 466035 -> 173490 134782...
output:
928618818
result:
ok single line: '928618818'
Test #85:
score: 0
Accepted
time: 376ms
memory: 44564kb
input:
493940 970637 10000 6099 5282 -> 418389 387067 -> 358790 153325 -> 301770 235967 -> 102869 423459 -> 139191 430471 -> 121669 216144 -> 200731 402254 -> 477682 286386 -> 360681 386417 -> 391438 76994 -> 442301 11572 -> 11573 366644 -> 482239 397460 -> 63620 109352 -> 298323 202263 -> 81225 447808 -> ...
output:
262176563
result:
ok single line: '262176563'
Test #86:
score: 0
Accepted
time: 9ms
memory: 13032kb
input:
100000 100000 25000 75000 25001 -- 25002 25001 -- 25003 25004 -- 25005 25004 -- 25006 25004 -- 25007 25008 -- 25009 25010 -- 25011 25010 -- 25012 25010 -- 25013 25010 -- 25014 25015 -- 25016 25015 -- 25017 25018 -- 25019 25018 -- 25020 25018 -- 25021 25018 -- 25022 25023 -- 25024 25025 -- 25026 2502...
output:
440327864
result:
ok single line: '440327864'
Test #87:
score: 0
Accepted
time: 5ms
memory: 10988kb
input:
75000 75000 1000 74000 1001 -- 1002 1001 -- 1003 1001 -- 1004 1001 -- 1005 1001 -- 1006 1001 -- 1007 1001 -- 1008 1001 -- 1009 1001 -- 1010 1001 -- 1011 1001 -- 1012 1001 -- 1013 1001 -- 1014 1001 -- 1015 1001 -- 1016 1001 -- 1017 1001 -- 1018 1001 -- 1019 1001 -- 1020 1001 -- 1021 1001 -- 1022 1001...
output:
596675385
result:
ok single line: '596675385'
Subtask #8:
score: 1
Accepted
Test #88:
score: 1
Accepted
time: 366ms
memory: 43588kb
input:
480708 955454 2700 3000 388875 -> 70598 291012 -> 448536 286286 -> 309350 318088 -> 166350 282465 -> 24518 105434 -> 428582 311061 -> 54247 215036 -> 160493 466140 -> 380586 439211 -> 243679 62163 -> 4975 45626 -> 181790 193723 -> 291420 380938 -> 433052 175749 -> 245603 337566 -> 257546 215130 -> 1...
output:
494413606
result:
ok single line: '494413606'
Test #89:
score: 0
Accepted
time: 142ms
memory: 46416kb
input:
496008 644010 200000 148004 175624 -> 348004 378674 -> 441899 389873 -> 225480 342285 -> 342284 448597 -> 423730 322481 -> 322480 277684 -> 277683 77730 -> 274002 139051 -> 381500 322431 -> 322430 489893 -> 219415 112629 -> 486020 478810 -> 342275 321971 -> 321970 327088 -> 327087 363335 -> 270837 3...
output:
954229272
result:
ok single line: '954229272'
Test #90:
score: 0
Accepted
time: 148ms
memory: 46936kb
input:
498230 636232 222222 138004 480207 -> 453312 408631 -> 384309 485518 -> 308746 324825 -> 324824 388831 -> 358066 229161 -> 229160 385297 -> 397758 142702 -> 291224 297711 -> 297710 327537 -> 327536 397078 -> 274400 357082 -> 357081 77969 -> 364228 154283 -> 443734 310590 -> 310589 408847 -> 404403 4...
output:
258213809
result:
ok single line: '258213809'
Test #91:
score: 0
Accepted
time: 337ms
memory: 44612kb
input:
494975 949914 20000 20000 261730 -> 185565 254679 -> 172344 402359 -> 214906 373849 -> 428203 281645 -> 136091 125187 -> 341931 462640 -> 200091 142930 -> 365911 214071 -> 332071 82054 -> 244475 337852 -> 251558 410341 -> 407460 76984 -> 356551 160086 -> 256813 46085 -> 96998 145571 -> 388527 92468 ...
output:
301988351
result:
ok single line: '301988351'
Test #92:
score: 0
Accepted
time: 191ms
memory: 42612kb
input:
490490 703325 175132 102522 394663 -> 436412 314850 -> 309375 320686 -> 371482 488334 -> 328419 96749 -> 414442 94040 -> 404383 366135 -> 210530 136895 -> 476576 389095 -> 334418 438739 -> 448203 255070 -> 255071 159144 -> 435287 278187 -> 401207 451251 -> 442582 325692 -> 369099 380119 -> 461839 18...
output:
356999585
result:
ok single line: '356999585'
Test #93:
score: 0
Accepted
time: 215ms
memory: 42604kb
input:
489629 701603 175132 102522 290093 -> 390378 356326 -> 355703 375321 -> 392645 282398 -> 463683 357200 -> 337331 488131 -> 425351 21471 -> 280273 354128 -> 281531 241194 -- 241193 448565 -> 299914 424570 -> 454714 433928 -> 322270 132511 -> 310734 81945 -> 341620 397469 -> 329500 334702 -> 364841 23...
output:
281413111
result:
ok single line: '281413111'
Test #94:
score: 0
Accepted
time: 199ms
memory: 49348kb
input:
499666 499666 555 499111 453774 -> 453775 222037 -- 222038 137377 -> 137378 38271 -> 38272 17472 -> 17473 476139 -- 476138 169846 -> 169847 207291 -- 207292 154547 -> 154548 8870 -> 8871 30831 -> 30832 362516 -- 362517 338576 -> 338577 172299 -- 172300 120623 -> 120624 446255 -> 446256 174751 -> 174...
output:
839107374
result:
ok single line: '839107374'
Test #95:
score: 0
Accepted
time: 206ms
memory: 47052kb
input:
499998 725241 162132 112623 341397 -> 374082 124176 -> 281045 347309 -> 256265 175782 -> 175781 306343 -> 265795 484857 -> 349365 316079 -> 385399 437275 -> 344602 399491 -> 385783 107396 -> 297503 445444 -> 499594 279433 -> 403003 440757 -> 474391 382626 -> 171183 368658 -> 418373 422288 -> 337394 ...
output:
950977224
result:
ok single line: '950977224'
Subtask #9:
score: 1
Accepted
Test #96:
score: 1
Accepted
time: 115ms
memory: 39976kb
input:
400000 480000 160000 160000 199014 -> 199013 319909 -> 319908 76229 -> 399348 238306 -> 238305 8126 -> 311875 185637 -> 185636 126461 -> 392362 21942 -> 298059 370410 -> 272104 249737 -> 249736 318535 -> 318534 234868 -> 234867 325080 -> 349112 20659 -> 299342 97739 -> 222262 338648 -> 328963 140316...
output:
4265270
result:
ok single line: '4265270'
Test #97:
score: 0
Accepted
time: 76ms
memory: 38868kb
input:
400000 440000 200000 160000 213655 -> 213654 141244 -> 321244 34272 -> 234272 391609 -> 200628 104245 -> 395977 198826 -> 360000 2057 -> 392900 260177 -> 260176 89899 -> 280000 133322 -> 313322 56719 -> 256719 96221 -> 280000 186086 -> 360000 391991 -> 218045 163493 -> 343493 304605 -> 304604 4682 -...
output:
657564815
result:
ok single line: '657564815'
Test #98:
score: 0
Accepted
time: 128ms
memory: 38316kb
input:
399800 535200 160000 104400 11990 -> 347813 43117 -> 388588 18636 -> 389792 265659 -> 306852 26761 -> 331154 17056 -> 299531 376984 -> 253830 169502 -> 169501 97591 -> 331647 43086 -> 388588 32045 -> 280581 220537 -> 220536 343611 -> 230558 264727 -> 362930 398029 -> 360215 347175 -> 311219 179822 -...
output:
517228123
result:
ok single line: '517228123'
Test #99:
score: 0
Accepted
time: 92ms
memory: 33344kb
input:
351695 690082 10000 2033 10004 -- 10005 10004 -- 10006 10013 -- 10014 10020 -- 10021 10035 -- 10036 10051 -- 10052 10082 -- 10083 10108 -- 10109 10118 -- 10119 10130 -- 10131 10140 -- 10141 10143 -- 10144 10157 -- 10158 10162 -- 10163 10167 -- 10168 10177 -- 10178 10202 -- 10203 10219 -- 10220 10257...
output:
152169504
result:
ok single line: '152169504'
Test #100:
score: 0
Accepted
time: 81ms
memory: 34612kb
input:
400000 390000 200000 190000 397214 -> 321809 1775 -> 395712 391127 -> 340206 98658 -> 391031 32 -> 395653 124610 -> 391443 99658 -> 393513 36870 -> 395789 392209 -> 236442 190851 -> 396433 64890 -> 399931 58344 -> 391218 179191 -> 394322 396399 -> 335766 139821 -> 391380 74397 -> 391498 396514 -> 34...
output:
636653587
result:
ok single line: '636653587'
Test #101:
score: 0
Accepted
time: 129ms
memory: 37320kb
input:
398739 589694 101005 113657 221002 -> 218311 352101 -> 326228 354641 -> 247781 208866 -> 208868 107323 -> 107324 95463 -> 316173 370662 -> 345086 79339 -> 319336 278287 -> 273751 357843 -> 119724 211175 -> 211173 258599 -> 258631 275550 -> 366741 382366 -> 186180 262292 -> 141138 136592 -> 136590 34...
output:
544988618
result:
ok single line: '544988618'
Test #102:
score: 0
Accepted
time: 233ms
memory: 43868kb
input:
400000 800000 200000 200000 359851 -> 359852 372128 -> 372129 116523 -> 116524 45533 -> 45532 117553 -> 117552 393469 -> 393468 25021 -> 347834 88897 -> 211709 34060 -> 356872 154826 -> 277639 360611 -> 360610 85147 -> 207959 51939 -> 51938 299450 -> 299451 3388 -> 326201 190542 -> 313355 39778 -> 3...
output:
82670508
result:
ok single line: '82670508'
Test #103:
score: 0
Accepted
time: 264ms
memory: 43476kb
input:
400000 1000000 100000 100000 300216 -> 132051 206792 -> 137475 270981 -> 105536 246362 -> 329345 310023 -> 150748 74064 -> 74063 282562 -> 294000 324227 -> 119187 392908 -> 367647 388738 -> 110385 274556 -> 117511 288311 -> 392960 306262 -> 267516 75581 -> 75582 281193 -> 197754 322811 -> 161235 424...
output:
893358877
result:
ok single line: '893358877'
Test #104:
score: 0
Accepted
time: 269ms
memory: 38740kb
input:
333336 1000000 4 4 54584 -> 1908 254177 -> 151524 23413 -> 152185 73103 -> 189507 318163 -> 171383 316019 -> 251166 185330 -> 198652 207025 -> 157679 216474 -> 163209 7692 -> 207642 149446 -> 91364 246860 -> 207270 144017 -> 326578 16445 -> 115277 185377 -> 198013 4654 -> 314014 218151 -> 241357 331...
output:
15
result:
ok single line: '15'
Test #105:
score: 0
Accepted
time: 67ms
memory: 34168kb
input:
400000 400000 1000 399000 1001 -- 1002 1001 -- 1003 1001 -- 1004 1001 -- 1005 1001 -- 1006 1001 -- 1007 1001 -- 1008 1001 -- 1009 1001 -- 1010 1001 -- 1011 1001 -- 1012 1001 -- 1013 1001 -- 1014 1001 -- 1015 1001 -- 1016 1001 -- 1017 1001 -- 1018 1001 -- 1019 1001 -- 1020 1001 -- 1021 1001 -- 1022 1...
output:
584509931
result:
ok single line: '584509931'
Test #106:
score: 0
Accepted
time: 46ms
memory: 35620kb
input:
400000 400000 100000 300000 100001 -- 100002 100001 -- 100003 100004 -- 100005 100004 -- 100006 100007 -- 100008 100007 -- 100009 100007 -- 100010 100011 -- 100012 100011 -- 100013 100011 -- 100014 100011 -- 100015 100016 -- 100017 100016 -- 100018 100019 -- 100020 100019 -- 100021 100019 -- 100022 ...
output:
364667902
result:
ok single line: '364667902'
Subtask #10:
score: 1
Accepted
Test #107:
score: 1
Accepted
time: 126ms
memory: 48032kb
input:
500000 600000 200000 200000 490947 -> 451215 158625 -> 358625 4102 -> 441807 143729 -> 441350 467680 -> 337343 233111 -> 233110 389278 -> 389277 388075 -> 388074 245479 -> 245478 481355 -> 407929 100889 -> 488543 473277 -> 237338 133370 -> 459162 473784 -> 436652 320846 -> 320845 161395 -> 361395 42...
output:
340462744
result:
ok single line: '340462744'
Test #108:
score: 0
Accepted
time: 119ms
memory: 47924kb
input:
500000 567858 222222 209920 341288 -> 341287 399241 -> 399240 432431 -> 351525 407255 -> 407254 275923 -> 275922 13674 -> 450913 271189 -> 271188 461131 -> 497036 211113 -> 427184 194361 -> 410432 494008 -> 441531 440844 -> 482899 475944 -> 457798 444645 -> 463826 152684 -> 368755 148911 -> 364982 1...
output:
295693530
result:
ok single line: '295693530'
Test #109:
score: 0
Accepted
time: 119ms
memory: 48592kb
input:
499209 600492 198963 198963 427300 -> 462809 495566 -> 476874 426586 -> 463714 489550 -> 321501 464826 -> 441232 460972 -> 492665 241058 -> 241057 480311 -> 481893 77213 -> 448810 470253 -> 318403 102023 -> 295904 362798 -> 362797 108819 -> 289108 26483 -> 371444 185929 -> 431653 278786 -> 278785 36...
output:
27156851
result:
ok single line: '27156851'
Test #110:
score: 0
Accepted
time: 229ms
memory: 41848kb
input:
496840 742660 250000 1020 264920 -> 313092 231339 -> 306596 310244 -> 408000 400340 -> 455212 27053 -> 487331 291300 -> 280206 172713 -> 482531 26318 -> 276450 8422 -> 374144 17232 -> 307436 328041 -> 438123 217526 -> 455217 368261 -> 278888 441490 -> 404527 480297 -> 316397 461374 -> 310281 443898 ...
output:
229142308
result:
ok single line: '229142308'
Test #111:
score: 0
Accepted
time: 225ms
memory: 41180kb
input:
498585 666165 180000 151006 37061 -> 435056 358274 -> 396666 451153 -> 428256 167913 -> 456807 270877 -- 270950 293106 -- 293071 59018 -> 420164 399141 -> 398398 178678 -> 468990 205968 -- 205944 156980 -> 367491 446160 -> 413072 341017 -> 460452 463438 -> 398625 372636 -> 360334 472447 -> 387793 12...
output:
263470678
result:
ok single line: '263470678'
Test #112:
score: 0
Accepted
time: 160ms
memory: 44884kb
input:
498610 983676 10000 2238 10005 -- 10006 10011 -- 10012 10028 -- 10029 10031 -- 10032 10049 -- 10050 10059 -- 10060 10068 -- 10069 10075 -- 10076 10080 -- 10081 10105 -- 10106 10117 -- 10118 10119 -- 10120 10124 -- 10125 10129 -- 10130 10129 -- 10131 10133 -- 10134 10158 -- 10159 10191 -- 10192 10193...
output:
352087169
result:
ok single line: '352087169'
Test #113:
score: 0
Accepted
time: 149ms
memory: 46904kb
input:
500000 500000 1 499999 207717 -> 207718 479061 -> 479062 205174 -> 205175 489791 -> 489792 133413 -> 133414 419886 -> 419887 480214 -> 480215 86704 -- 86703 213375 -> 213376 101853 -> 101854 165466 -> 165467 393562 -> 393563 298592 -> 298593 340634 -> 340635 32536 -> 32537 233442 -> 233443 328155 ->...
output:
483815610
result:
ok single line: '483815610'
Test #114:
score: 0
Accepted
time: 343ms
memory: 45048kb
input:
498295 987924 4333 4333 65477 -> 397560 234456 -> 444087 336223 -> 461726 277289 -> 342287 477459 -> 355292 495663 -> 444091 361508 -> 470061 14364 -> 442921 28753 -> 306375 466300 -> 179218 282509 -> 94461 468703 -> 479055 377215 -> 130073 43390 -> 286528 423006 -> 351739 162845 -> 393997 458505 ->...
output:
581720061
result:
ok single line: '581720061'
Test #115:
score: 0
Accepted
time: 198ms
memory: 46048kb
input:
497286 725246 111717 192702 372291 -> 463758 15319 -> 331957 410429 -> 246825 359344 -> 319568 75481 -> 318124 23097 -> 387353 483774 -> 320048 46080 -> 429618 329285 -> 210098 72733 -> 411598 428938 -> 315224 124941 -> 124942 110646 -> 128574 57778 -> 444071 232020 -> 232019 399116 -> 359149 463313...
output:
258346896
result:
ok single line: '258346896'
Test #116:
score: 0
Accepted
time: 211ms
memory: 44372kb
input:
491159 764619 111717 105505 451524 -> 198253 250752 -> 434433 109799 -> 234176 297005 -> 290558 76851 -> 305542 277874 -> 358722 264288 -> 239921 295345 -> 460252 416821 -> 341684 290258 -> 392886 330962 -> 143914 320070 -> 224613 467749 -> 215292 487782 -> 202645 378695 -> 163595 65543 -> 311244 22...
output:
981886548
result:
ok single line: '981886548'
Test #117:
score: 0
Accepted
time: 63ms
memory: 41232kb
input:
500000 500000 5000 495000 5001 -- 5002 5001 -- 5003 5001 -- 5004 5001 -- 5005 5001 -- 5006 5001 -- 5007 5001 -- 5008 5001 -- 5009 5001 -- 5010 5001 -- 5011 5001 -- 5012 5001 -- 5013 5001 -- 5014 5001 -- 5015 5001 -- 5016 5001 -- 5017 5001 -- 5018 5001 -- 5019 5001 -- 5020 5001 -- 5021 5001 -- 5022 5...
output:
536327127
result:
ok single line: '536327127'
Test #118:
score: 0
Accepted
time: 62ms
memory: 41196kb
input:
500000 500000 5000 495000 5001 -- 5002 5001 -- 5003 5001 -- 5004 5001 -- 5005 5001 -- 5006 5001 -- 5007 5001 -- 5008 5001 -- 5009 5001 -- 5010 5001 -- 5011 5001 -- 5012 5001 -- 5013 5001 -- 5014 5001 -- 5015 5001 -- 5016 5001 -- 5017 5001 -- 5018 5001 -- 5019 5001 -- 5020 5001 -- 5021 5001 -- 5022 5...
output:
509835702
result:
ok single line: '509835702'
Extra Test:
score: 0
Extra Test Passed