QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#326676#1411. Communication Jammingtuanlinh1230 4ms14172kbC++204.1kb2024-02-13 18:24:472024-02-13 18:24:48

Judging History

你现在查看的是最新测评结果

  • [2024-02-13 18:24:48]
  • 评测
  • 测评结果:0
  • 用时:4ms
  • 内存:14172kb
  • [2024-02-13 18:24:47]
  • 提交

answer

#include<bits/stdc++.h>
#define ll int
#define pll pair<ll, ll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ld long double
using namespace std;

const ll maxn=200005;
ll l1[maxn], r1[maxn], l2[maxn], r2[maxn];
ll X1[maxn], Y1[maxn], X2[maxn], Y2[maxn];
ll n, to[maxn], pa[maxn], Rank[maxn], l[maxn], r[maxn];
vector <ll> A1[maxn], A2[maxn], H1[maxn], H2[maxn];
vector <pll> req[maxn]; 

ll Find(ll i)
{
    if (pa[i]!=i)
        pa[i]=Find(pa[i]);
    return pa[i];
}

void Union(ll a, ll b)
{
    ll Pa=Find(a), Pb=Find(b);
    if (Pa==Pb) return;
    if (Rank[Pa]<Rank[Pb]) swap(Pa, Pb);
    if (Rank[Pa]==Rank[Pb]) Rank[Pa]++;
    pa[Pb]=Pa, l[Pa]=min(l[Pa], l[Pb]), r[Pa]=max(r[Pa], r[Pb]);
}

void dfs1(ll u)
{
    l1[u]=n, r1[u]=0;
    for (ll v:A1[u])
    {
        if (!l1[v]) dfs1(v);
        l1[u]=min(l1[u], l1[v]), r1[u]=max(r1[u], r1[v]);
    }
}

void dfs2(ll u)
{
    l2[u]=n, r2[u]=0;
    for (ll v:A2[u])
    {
        if (!l2[v]) dfs2(v);
        l2[u]=min(l2[u], l2[v]), r2[u]=max(r2[u], r2[v]);
    }
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    ll m1, m2, q; cin >> n >> m1 >> m2 >> q;
    for (ll i=1; i<=n; i++)
        l1[i]=r1[i]=l2[i]=r2[i]=pa[i]=l[i]=r[i]=i;
    vector <ll> num1, num2; num2.pb(0);
    for (ll i=1; i<=m1; i++)
        cin >> X1[i] >> Y1[i], num1.pb(Y1[i]);
    sort(num1.begin(), num1.end());
    num1.resize(unique(num1.begin(), num1.end())-num1.begin());
    for (ll i=1; i<=m1; i++)
        H1[lower_bound(num1.begin(), num1.end(), Y1[i])-num1.begin()].pb(i+n);
    for (ll i=1; i<n+m1; i++)
    {
        ll t, u, v; cin >> t >> u >> v;
        if (t==1) A1[v+n].pb(u);
        else if (mp(Y1[v], X1[v])>mp(Y1[u], X1[u])) A1[v+n].pb(u+n);
        else A1[u+n].pb(v+n);
    }
    for (ll i=1; i<=m2; i++)
        cin >> X2[i] >> Y2[i], num2.pb(Y2[i]);
    sort(num2.begin(), num2.end(), greater<ll>());
    num2.resize(unique(num2.begin(), num2.end())-num2.begin());
    for (ll i=1; i<=m2; i++)
        H2[lower_bound(num2.begin(), num2.end(), Y2[i], greater<ll>())-num2.begin()].pb(i+n);
    for (ll i=1; i<n+m2; i++)
    {
        ll t, u, v; cin >> t >> u >> v;
        if (t==1) A2[v+n].pb(u);
        else if (mp(Y2[v], X2[v])<mp(Y2[u], X2[u])) A2[v+n].pb(u+n);
        else A2[u+n].pb(v+n);
    }
    for (ll i=1; i<=n+m1; i++)
        if (!l1[i]) dfs1(i);
    vector <pair<pll, ll>> order;
    for (ll i=1; i<=m1; i++)
        order.pb({{Y1[i], X1[i]}, i+n});
    sort(order.begin(), order.end());
    for (ll i=0; i<order.size(); i++)
    {
        ll id=order[i].se;
        vector <pll> c;
        for (ll j:A1[id])
            if (r1[j]) c.pb({l[Find(l1[j])], r[Find(r1[j])]});
        sort(c.begin(), c.end());
        for (ll i=0; i+1<c.size(); i++)
        {
            if (c[i].se+1!=c[i+1].fi)
            {
                cout << id << "\n";
                function <void(int)> dfs=[&](ll u)
                {
                    cout << u << " " << l1[u] << " " << r1[u] << " " << l[Find(l1[u])] << " " << r[Find(r1[u])] << "\n";
                    for (ll v:A1[u]) dfs(v);
                }; dfs(id);
                exit(0);
            }
            req[id].pb({c[i].se, c[i+1].fi}), Union(c[i].se, c[i+1].fi);
        }
    }
    for (ll i=1; i<=n+m2; i++)
        if (!l2[i]) dfs2(i);
    ll k1=num1.size(), k2=num2.size();
    auto in=[&](ll a, ll b) {return r[Find(a)]>=b;};
    auto insert=[&](ll a, ll b)
    {
        while (r[Find(a)]<b) 
            a=r[Find(a)]+1, Union(a, a-1);
    };
    for (ll i=1; i<=n; i++) pa[i]=l[i]=r[i]=i, Rank[i]=0;
    for (ll i=k1, ptr=0; i>=0; i--)
    {
        for (ll j:H1[i]) for (auto [l, r]:req[j])
        {
            while (!in(l, r))
            {
                ptr++;
                for (ll j:H2[ptr]) 
                    if (r2[j]) insert(l2[j], r2[j]);
            }
        }
        to[i]=ptr;
    }
    for (ll i=1; i<=q; i++)
    {
        ll a; cin >> a;
        ll pos=upper_bound(num1.begin(), num1.end(), a)-num1.begin();
        cout << num2[to[pos]] << "\n";
    }
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 20
Accepted
time: 3ms
memory: 13896kb

input:

100 99 99 100
40 71
79 29
1 20
88 54
70 38
77 30
31 12
79 81
84 34
17 65
68 57
40 2
14 22
56 3
15 17
11 75
36 77
52 7
30 91
82 13
19 64
44 14
63 41
38 18
99 84
22 49
68 39
64 63
99 93
8 48
66 10
6 83
45 35
94 37
58 87
89 15
71 4
75 60
59 42
74 62
56 59
82 73
90 24
76 95
36 21
91 67
33 31
13 79
20 50...

output:

-98
-98
-95
-95
-95
-99
-98
-98
-95
-98
-98
-99
-98
-98
-89
-95
-98
-98
-99
-98
-98
-95
-99
-95
-98
-95
-95
-95
-95
-95
-95
-95
-98
-98
-95
-99
-98
-98
-98
-99
-95
-98
-95
-98
-98
-98
-95
-95
-89
-98
-98
-95
-98
-95
-99
-99
-95
-99
-98
-98
-95
-98
-98
-95
-98
-98
-95
-98
-95
-99
-98
-95
-98
-95
-95
...

result:

ok 100 lines

Test #2:

score: 0
Accepted
time: 0ms
memory: 13832kb

input:

100 99 99 100
62 48
60 86
34 55
43 69
80 46
37 29
9 61
54 44
1 98
73 39
98 64
59 62
60 71
93 33
27 27
18 99
56 43
35 81
39 93
82 89
64 45
46 17
100 34
75 85
70 74
84 60
51 63
81 6
72 24
16 76
23 73
42 50
69 84
87 87
2 1
48 68
40 5
69 40
84 41
54 51
15 9
97 7
31 92
12 16
32 4
77 47
17 30
6 58
30 56
4...

output:

-97
-99
-99
-99
-97
-97
-99
-97
-97
-97
-97
-97
-97
-99
-99
-97
-97
-99
-99
-99
-97
-97
-97
-99
-99
-99
-97
-97
-97
-97
-97
-1
-97
-99
-97
-97
-97
-97
-97
-97
-99
-97
-97
-97
-99
-96
-99
-99
-96
-97
0
-97
-97
-97
-97
-97
-97
-38
-97
-97
-99
-97
-97
-99
-96
-97
-99
-97
-97
-97
-97
-99
-97
-99
-97
-97...

result:

ok 100 lines

Test #3:

score: 0
Accepted
time: 2ms
memory: 13908kb

input:

100 99 99 100
77 73
75 16
56 37
48 27
95 40
88 99
26 87
25 14
44 43
7 55
44 4
55 2
26 23
42 68
10 26
89 1
21 19
37 35
83 72
20 20
21 81
6 46
1 18
3 90
91 71
69 65
67 38
69 63
98 10
39 69
46 42
88 93
34 92
59 6
50 47
86 49
30 24
74 21
81 78
12 61
66 53
30 98
9 45
16 32
95 51
34 77
90 67
54 59
76 80
7...

output:

-99
-93
-99
-91
-99
-91
-99
-93
-93
-93
-93
-93
-99
-99
-99
-93
-93
-93
-99
-91
-91
-93
-93
-93
-99
-91
-99
-99
-93
-99
-91
-99
-93
-99
-99
-99
-99
0
-91
-93
-91
-93
-93
-99
-99
-99
-99
-99
-93
-99
-93
-99
-91
-93
-91
-91
-93
-91
-93
-93
-99
-93
-91
-99
-93
-91
-99
-99
-93
-93
-99
-91
-61
-93
-93
-9...

result:

ok 100 lines

Test #4:

score: 0
Accepted
time: 0ms
memory: 13888kb

input:

100 99 99 100
24 3
87 3
37 2
37 7
23 2
42 2
92 8
22 4
78 3
86 1
48 3
64 5
94 1
100 2
25 1
81 7
36 10
10 2
8 3
97 4
19 1
68 3
16 3
14 1
19 6
70 4
29 2
97 3
88 1
58 10
35 1
83 4
32 9
56 3
15 4
90 1
6 5
65 1
51 1
43 5
72 9
2 1
69 2
3 3
42 1
74 4
16 2
52 4
61 3
76 1
54 2
65 2
54 1
77 2
67 1
81 6
29 3
34...

output:

0
0
0
0
0
-7
0
0
0
0
-7
0
0
0
0
-9
0
0
0
0
0
0
0
-2
0
0
0
0
-10
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-7
0
0
0
0
0
0
0
0
0
0
0
0
-7
-7
0
-9
0
0
0
0
0
-7
0
-10
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

result:

ok 100 lines

Test #5:

score: 0
Accepted
time: 3ms
memory: 13836kb

input:

100 99 99 100
22 94
11 7
7 98
57 63
31 77
2 23
83 91
60 73
59 51
75 57
5 96
98 41
45 19
73 53
13 82
95 97
63 72
38 4
94 60
49 26
79 8
41 92
32 9
8 6
82 56
68 64
33 36
54 34
77 87
71 31
13 80
66 83
44 14
70 32
91 76
51 24
52 84
47 68
85 89
100 20
73 55
88 13
24 81
29 86
18 79
3 22
97 21
81 45
23 1
75...

output:

-16
-16
-16
-16
-16
-16
-16
-16
-16
-16
-16
-16
-16
-16
-16
-16
-16
-16
-16
-16
-16
-16
-16
-16
-16
-16
-16
-16
-16
-16
-16
-16
-16
-16
-16
-16
-3
-16
-3
-16
-16
-16
-16
-16
-16
-16
-16
-16
-16
-16
-16
-16
-3
-16
-16
-16
-16
-16
-16
-16
-16
-16
-16
-16
-16
-16
-16
-16
-16
-16
-16
-16
-16
-16
-16
-16...

result:

ok 100 lines

Test #6:

score: 0
Accepted
time: 0ms
memory: 14036kb

input:

100 99 99 100
50 1
18 1
34 3
24 3
6 2
42 4
14 5
69 1
65 4
36 1
19 3
36 6
73 2
53 1
41 1
32 2
6 1
75 1
45 2
27 1
14 1
15 4
82 2
64 1
10 1
76 3
50 3
19 1
12 3
39 1
60 2
98 2
71 5
55 6
97 1
40 3
38 5
46 1
51 5
2 1
57 3
62 2
35 1
96 3
88 7
60 13
59 1
26 2
91 10
12 4
91 1
62 1
17 2
77 6
66 1
21 14
84 1
2...

output:

0
0
-90
-90
0
0
0
0
0
0
0
0
0
0
0
0
0
-35
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-90
0
0
0
0
0
-99
0
-90
0
0
0
-90
0
-99
-99
-99
0
0
0
0
0
0
0
0
0
-99
0
0
0
0
0
0
0
0
0
0
0
0
-30
-90
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-99
0
0
0
0
0
0
0
0
0
0
0

result:

ok 100 lines

Test #7:

score: 0
Accepted
time: 3ms
memory: 13908kb

input:

100 99 99 100
50 71
6 86
31 83
99 31
17 84
74 90
21 43
29 30
44 57
69 41
27 33
37 78
75 16
99 8
24 98
42 10
38 72
64 67
62 68
93 35
25 99
30 88
66 12
91 65
84 66
12 23
72 54
96 95
3 34
2 29
65 42
44 37
61 45
5 85
20 40
39 73
70 70
81 21
14 62
28 9
16 61
9 5
95 76
90 36
54 17
79 75
48 4
52 18
31 96
6...

output:

-51
-33
-88
-11
-96
-92
-53
-53
-41
-46
-17
-24
-44
-98
-1
-94
-41
-60
-91
-41
-99
-4
-48
-94
-66
-90
-72
-66
-32
-60
-60
-56
-10
-72
-78
-96
-50
-31
-23
-16
-37
-9
-20
-22
-45
-28
-74
-45
-86
-67
-82
-70
-50
-63
-76
-41
-6
-16
-41
-76
-34
-72
-88
-7
-35
-80
-7
-82
-26
-15
-31
-22
-47
0
-3
-28
-31
-...

result:

ok 100 lines

Test #8:

score: 0
Accepted
time: 0ms
memory: 13796kb

input:

100 99 99 100
94 28
42 79
56 77
38 8
32 9
2 19
77 84
84 16
16 47
43 2
53 89
89 71
13 63
3 18
85 97
5 96
70 72
48 66
10 88
7 49
40 81
57 43
95 61
66 45
61 11
67 24
43 92
32 34
59 26
16 22
35 74
50 38
17 67
63 76
19 4
62 42
53 64
35 33
21 86
93 37
46 12
48 39
8 98
25 85
2 50
88 32
12 48
25 41
95 54
91...

output:

-5
-37
-40
-88
-32
-27
-47
-86
-85
-99
-86
-70
-99
-31
-21
-96
-42
-66
-9
-41
-23
-22
-20
-74
-79
-60
-85
-20
-58
-56
-34
-63
-94
-16
-63
-33
-85
-59
-96
-75
-39
-68
-66
-85
-7
-68
-17
-53
-55
-85
-48
-94
-21
-7
-35
-47
-8
-22
-76
-26
-74
-15
-92
-91
-36
-40
-45
-56
-26
-70
-13
-44
-62
-91
-44
-28
-...

result:

ok 100 lines

Test #9:

score: 0
Accepted
time: 0ms
memory: 13832kb

input:

100 99 99 100
37 14
14 12
48 41
89 79
89 38
19 1
77 29
45 5
80 76
72 96
74 10
61 59
98 7
14 20
2 23
41 15
9 33
19 37
46 8
96 3
94 90
68 13
99 92
76 68
25 17
36 40
68 83
77 66
39 82
79 16
12 63
52 42
73 53
56 98
56 24
63 91
34 46
28 19
38 80
90 11
47 43
17 70
29 36
5 84
42 99
51 65
43 6
59 44
4 81
42...

output:

-40
-84
-87
-31
-53
-87
-38
-5
-36
-15
-84
-85
-58
-45
-85
-96
-10
-66
-81
-56
-15
-37
-68
-51
-75
-34
0
-3
-21
-99
-51
-54
-24
-73
-88
-7
-8
-62
-21
-10
-21
-96
-48
-42
-58
-15
-78
-31
-51
-44
-34
-99
-26
-97
-59
-56
-21
-90
-16
-1
-84
-25
-71
-73
-36
-11
-28
-95
-66
-47
-92
-31
-46
-15
-81
-74
-43...

result:

ok 100 lines

Test #10:

score: 0
Accepted
time: 0ms
memory: 13916kb

input:

100 99 99 100
76 93
59 12
54 11
40 74
73 43
48 47
38 31
95 78
65 37
28 44
96 17
35 13
90 85
86 65
81 4
88 79
71 64
47 15
41 63
52 46
32 90
42 73
16 9
62 10
87 94
97 70
2 99
42 21
6 5
21 6
58 58
56 76
100 69
46 83
12 42
31 75
74 14
97 24
37 50
9 35
5 8
22 84
69 39
30 49
54 52
77 51
27 38
94 45
25 16
...

output:

-38
-22
-40
-98
-25
-4
-46
-80
-43
-46
-77
-98
-4
-51
-82
-85
-7
-46
-35
-51
-75
-15
-77
-70
-90
-12
-55
-12
-59
-31
-55
-62
-88
-62
-9
-51
-7
-17
-86
-85
-59
-48
-28
-43
-92
-22
-19
-22
-46
-14
-12
-51
-27
-13
-35
-4
-90
-38
-19
-70
-19
-73
-65
-75
-64
-1
-75
-94
-85
-73
-32
-70
0
-80
-94
-27
-60
-...

result:

ok 100 lines

Test #11:

score: 0
Accepted
time: 4ms
memory: 14172kb

input:

1000 999 999 1000
29 797
230 668
310 981
2 879
197 826
352 362
407 805
890 87
249 584
295 199
531 588
687 528
433 565
288 46
385 474
431 86
639 686
942 656
388 667
310 282
737 578
161 430
823 664
333 979
989 745
46 432
999 236
962 545
949 655
902 406
812 521
632 812
715 47
313 691
840 665
294 336
72...

output:

-995
-999
-998
-999
-999
-999
-999
-999
-995
-999
-995
-999
-999
-999
-999
-998
-995
-995
-998
-995
-998
-999
-995
-995
-998
-995
-999
-995
-995
-998
-999
-999
-995
-998
-999
-999
-999
-999
-999
-999
-998
-999
-995
-998
-995
-998
-995
-995
-995
-999
-995
-999
-999
-995
-998
-995
-999
-995
-999
-999
...

result:

ok 1000 lines

Test #12:

score: 0
Accepted
time: 0ms
memory: 14028kb

input:

1000 999 999 1000
113 7
720 15
233 4
882 1
419 1
818 2
746 2
168 1
682 3
470 5
927 11
673 3
945 1
178 6
25 3
460 2
26 7
709 1
746 1
563 6
309 3
280 2
774 2
657 2
133 5
512 1
394 1
634 4
175 6
720 7
272 12
825 1
287 2
787 1
327 2
978 7
705 1
758 6
716 1
101 1
46 3
273 1
545 1
62 9
316 7
247 2
917 1
7...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-12
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-12
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-5
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0...

result:

ok 1000 lines

Test #13:

score: 0
Accepted
time: 4ms
memory: 14008kb

input:

1000 999 999 1000
186 468
139 615
570 530
605 807
641 183
726 576
130 798
424 351
211 765
738 860
537 162
784 345
176 130
683 52
564 622
977 483
670 264
204 124
573 195
222 490
561 635
265 350
89 642
75 539
760 517
630 139
955 417
173 458
69 497
246 718
852 972
321 813
840 521
889 276
748 801
658 59...

output:

-22
-21
-11
-22
-21
-22
-22
-22
-22
-21
-21
-21
-22
-22
-22
-21
-21
-11
-22
-21
-21
-22
-4
-22
-11
-22
-21
-11
-11
-21
-22
-22
-21
-22
-22
-21
-22
-21
-21
-21
-22
-16
-22
-22
-8
-21
-11
-21
-21
-22
-11
-21
-22
-21
-21
-21
-21
-21
-22
-11
-22
-22
-22
-22
-22
-22
-22
-21
-21
-21
-21
-21
-11
-21
-21
-2...

result:

ok 1000 lines

Test #14:

score: 0
Accepted
time: 4ms
memory: 14128kb

input:

1000 999 999 1000
750 2
443 4
154 3
57 1
921 3
571 4
203 2
973 1
947 1
473 1
351 1
399 1
569 2
897 7
724 2
449 3
879 5
814 1
451 2
392 3
648 1
403 1
69 1
960 1
631 1
885 1
124 2
243 13
735 3
245 2
867 1
295 12
14 1
765 2
972 2
474 2
715 2
949 1
433 1
495 2
845 2
999 1
669 4
560 5
393 2
462 6
501 4
1...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-997
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-965
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-997
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0...

result:

ok 1000 lines

Test #15:

score: 0
Accepted
time: 2ms
memory: 14136kb

input:

1000 999 999 1000
339 258
742 59
9 789
162 443
644 881
258 148
738 874
784 97
744 944
392 633
73 175
587 102
121 735
791 35
281 588
310 540
795 699
934 4
574 911
44 747
320 716
86 376
84 115
491 648
555 459
275 251
108 49
485 888
465 437
301 329
832 891
617 955
950 558
356 961
264 153
446 128
95 185...

output:

-983
-998
-998
-959
-934
-999
-999
-999
-998
-999
-999
-999
-999
-998
-999
-998
-998
-999
-998
-999
-998
-945
-999
-998
-999
-998
-999
-959
-999
-999
-934
-998
-999
-998
-999
-998
-998
-998
-983
-983
-983
-999
-998
-999
-998
-999
-998
-999
-983
-999
-998
-999
-998
-999
-945
-999
-999
-998
-998
-999
...

result:

ok 1000 lines

Test #16:

score: 0
Accepted
time: 1ms
memory: 14056kb

input:

1000 999 999 1000
664 444
906 415
58 123
271 234
85 819
661 994
767 121
918 963
229 344
431 250
474 889
87 908
329 528
172 290
43 958
647 944
169 510
287 1
624 690
59 520
537 903
764 639
820 441
915 89
429 655
286 877
504 484
742 143
241 986
281 129
531 798
4 519
521 401
33 32
853 326
228 157
344 75...

output:

-999
-998
-990
-999
-999
-999
-996
-990
-999
-999
-999
-998
-999
-999
-999
-999
-999
-999
-999
-999
-996
-999
-999
-999
-999
-999
-941
-999
-999
-999
-999
-999
-999
-999
-999
-996
-999
-998
-999
-999
-999
-999
-999
-996
-999
-999
-999
-999
-999
-999
-996
-996
-999
-999
-999
-999
-999
-999
-990
-999
...

result:

ok 1000 lines

Test #17:

score: 0
Accepted
time: 0ms
memory: 14100kb

input:

1000 999 999 1000
247 409
208 518
746 474
615 302
137 504
690 823
523 416
729 795
652 183
597 121
643 287
634 157
985 867
375 359
456 549
553 637
509 900
434 793
13 147
36 125
542 742
647 413
979 712
153 391
20 577
800 895
480 122
509 478
575 281
552 305
468 468
155 980
607 966
285 256
437 576
295 8...

output:

-506
-680
-606
-408
-188
-465
-70
-967
-515
-311
-652
-448
-15
-436
-541
-840
-465
-430
-766
-814
-885
-250
-900
-640
-689
-58
-101
-387
-372
-862
-739
-639
-263
-380
-265
-814
-700
-244
-209
-836
-147
-590
-342
-769
-612
-935
-455
-133
-233
-702
-26
-594
-874
-538
-963
-42
-491
-750
-675
-578
-351
...

result:

ok 1000 lines

Test #18:

score: 0
Accepted
time: 0ms
memory: 14140kb

input:

1000 999 999 1000
76 531
513 936
377 350
881 868
184 119
42 199
417 516
446 82
430 865
588 775
519 198
827 966
475 677
573 195
49 247
666 61
977 698
181 335
991 241
33 100
429 605
421 311
736 913
242 903
296 266
505 772
605 85
136 878
323 215
770 291
301 741
137 73
133 265
464 160
101 407
84 996
863...

output:

-195
-512
-820
-313
-761
-661
-899
-136
-851
-230
-916
-246
-288
-116
-558
-761
-424
-144
-846
-957
-862
-59
-265
-331
-774
-945
-165
-280
-104
-398
-710
-738
-240
-772
-140
-793
-284
-714
-548
-138
-605
-239
-765
-312
-943
-960
-315
-331
-717
-265
-385
-703
-371
-847
-88
-200
-949
-984
-499
-932
-4...

result:

ok 1000 lines

Test #19:

score: 0
Accepted
time: 3ms
memory: 14164kb

input:

1000 999 999 1000
981 981
567 567
622 622
868 868
676 676
696 696
996 996
580 580
20 20
388 388
468 468
333 333
65 65
291 291
459 459
472 472
978 978
251 251
518 518
989 989
101 101
825 825
599 599
565 565
339 339
486 486
292 292
935 935
796 796
290 290
371 371
715 715
934 934
898 898
160 160
96 96
...

output:

-548
-615
-864
-712
-51
-205
-831
-64
-182
-307
-701
-414
-127
-762
-163
-122
-985
-868
-539
-375
-428
-679
-167
-186
-389
-224
-953
-9
-396
-606
-616
-794
-51
-662
-112
-505
-569
-100
-99
-558
-268
-109
-72
-912
-202
-884
-637
-523
-384
-774
-268
-288
-405
-334
-491
-193
-994
-996
-221
-359
-884
-3...

result:

ok 1000 lines

Test #20:

score: 0
Accepted
time: 3ms
memory: 14108kb

input:

1000 999 999 1000
899 101
360 642
326 676
517 486
488 515
846 155
148 850
906 94
842 157
575 425
358 640
259 743
920 80
280 721
122 878
962 38
356 645
614 386
861 138
419 581
923 78
859 141
916 85
700 300
157 844
197 801
741 260
972 27
219 780
182 821
115 887
415 584
75 924
186 813
758 242
659 341
5...

output:

-167
-767
-477
-985
-709
-570
-522
-595
-552
-748
-54
-54
-150
-444
-182
-885
-94
-627
-63
-189
-623
-756
-187
-887
-15
-312
-62
-351
-832
-54
-902
-143
-523
-783
-267
-791
-931
-597
-437
-610
-388
-372
-153
-229
-519
-829
-744
-600
-146
-709
-111
-510
-937
-737
-528
-39
-721
-115
-612
-434
-335
-15...

result:

ok 1000 lines

Test #21:

score: -20
Wrong Answer
time: 0ms
memory: 14096kb

input:

300 999 999 1000
192 269
245 1
237 211
479 2
284 180
478 409
79 2
262 1
213 268
371 93
34 2
462 75
408 36
268 270
434 2
347 1
84 1
363 2
486 442
122 392
143 24
25 1
398 1
169 138
304 1
396 1
175 276
57 2
158 102
322 1
24 1
365 2
270 1
280 169
77 2
38 1
235 1
452 25
297 203
38 213
341 63
427 2
384 1
...

output:

988
988 61 64 61 64
757 61 61 61 61
1233 61 61 61 61
61 61 61 61 61
435 300 0 297 0
746 63 64 63 64
384 300 0 297 0
389 63 64 63 64
461 63 63 63 64
63 63 63 63 64
1187 64 64 63 64
64 64 64 63 64

result:

wrong answer 1st lines differ - expected: '0', found: '988'

Subtask #2:

score: 0
Skipped

Dependency #1:

0%