QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#311167#508. Nice sequencejasper16676 1933ms32676kbC++171.7kb2024-01-22 00:24:452024-01-22 00:24:46

Judging History

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

  • [2024-01-22 00:24:46]
  • 评测
  • 测评结果:76
  • 用时:1933ms
  • 内存:32676kb
  • [2024-01-22 00:24:45]
  • 提交

answer

#include "bits/stdc++.h"
// @JASPER'S BOILERPLATE
using namespace std;
using ll = long long;

#ifdef JASPER
#include "debug.h"
#else
#define debug(...) 166
#endif

const int N = 2e5 + 5;
int n, m;
vector <int> adj[N << 1];
int deg[N << 1], a[N << 1];

bool check(int k) {
    for (int i = 0; i <= k; ++i) {
        if (i + m <= k) {
            adj[i].push_back(i + m);
            deg[i + m]++;
        }
        if (i >= n) {
            adj[i].push_back(i - n);
            deg[i - n]++;
        }
    }

    queue <int> q;
    for (int i = 0; i <= k; ++i)
        if (deg[i] == 0)
            q.push(i);

    int cnt = 0;
    vector <int> topo;
    while (!q.empty()) {
        int u = q.front(); q.pop();
        topo.push_back(u);
        a[u] = ++cnt;
        for (int v : adj[u]) {
            deg[v]--;
            if (deg[v] == 0) q.push(v);
        }
    }
    for (int i = 0; i <= k; ++i) {
        adj[i].clear();
        deg[i] = 0;
    }
    // if the graph is cyclic then no topo order exists
    return ((int) topo.size() == k + 1);
}

signed main() {
    cin.tie(0) -> sync_with_stdio(0);
    
    int T; 
    cin >> T;
    while (T--) {
        cin >> n >> m;
        int l = 1, r = 2 * (m + n - 1);
        int ans = 0;
//        debug(check(3));
        while (l <= r) {
            int mi = (l + r) / 2;
            if (check(mi)) {
                ans = mi;
                l = mi + 1;
            }
            else 
                r = mi - 1;
        } 
        check(ans);
        cout << ans << "\n";
        for (int i = 1; i <= ans; ++i) {
            cout << (a[i] - a[i - 1]) << " \n"[i == ans];
        }   
    }
}



详细

Subtask #1:

score: 6
Accepted

Test #1:

score: 6
Accepted
time: 0ms
memory: 15300kb

input:

3
3 1
2 3
1 1

output:

2
1 1
3
2 -3 2
0

result:

ok Ok

Test #2:

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

input:

10
1 1
1 2
1 3
1 4
1 5
6 1
7 1
8 1
9 1
100 1

output:

0
1
-1
2
-1 -1
3
-1 -1 -1
4
-1 -1 -1 -1
5
1 1 1 1 1
6
1 1 1 1 1 1
7
1 1 1 1 1 1 1
8
1 1 1 1 1 1 1 1
99
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

result:

ok Ok

Test #3:

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

input:

10
60 1
70 1
1 60
1 70
1 50
39 1
41 1
23 1
1 99
87 3

output:

59
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
69
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
59
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1...

result:

ok Ok

Test #4:

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

input:

10
94 94
27 54
31 31
28 28
76 76
35 35
89 89
57 57
90 18
13 39

output:

93
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
53
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -53 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
...

result:

ok Ok

Test #5:

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

input:

10
67 67
64 64
82 82
16 96
74 74
37 37
90 90
59 59
66 66
14 7

output:

66
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
63
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
81
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

result:

ok Ok

Test #6:

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

input:

10
49 98
15 90
14 56
54 18
67 67
50 100
90 90
85 85
94 94
65 65

output:

97
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -97 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
89
1 1 1 1 1 1 1 1 1 1 1 1 1 1 -29 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -29 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -29 1 ...

result:

ok Ok

Test #7:

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

input:

10
19 19
77 77
85 17
4 4
80 80
98 98
94 94
100 100
88 22
77 77

output:

18
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
76
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
84
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

result:

ok Ok

Test #8:

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

input:

10
36 36
21 84
51 51
72 24
88 44
29 29
20 20
67 67
82 82
92 92

output:

35
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
83
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -41 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -41 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -41 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
50
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

result:

ok Ok

Test #9:

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

input:

10
4 12
95 95
59 59
48 48
23 23
76 76
35 5
97 97
89 89
58 58

output:

11
1 1 1 -7 1 1 1 -7 1 1 1
94
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
58
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

result:

ok Ok

Test #10:

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

input:

10
74 74
71 71
95 95
90 15
35 35
88 88
58 58
49 98
84 84
67 67

output:

73
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
70
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
94
1 1 1...

result:

ok Ok

Test #11:

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

input:

10
78 78
59 59
40 40
49 49
74 37
2 56
77 77
33 33
93 93
11 11

output:

77
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
58
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
39
1 1 1 1 1 1 1 1 1 1 1...

result:

ok Ok

Test #12:

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

input:

10
52 52
20 100
95 95
91 91
41 82
50 50
89 89
78 78
80 80
44 22

output:

51
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
99
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -39 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -39 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -39 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -39 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok Ok

Test #13:

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

input:

10
69 69
36 36
48 48
32 32
55 55
69 69
80 80
75 75
71 71
62 62

output:

68
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
35
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
47
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

result:

ok Ok

Subtask #2:

score: 9
Accepted

Test #14:

score: 9
Accepted
time: 4ms
memory: 15900kb

input:

10
2 2
3 2
4 2
5 2
2 6
2 7
2 8
9 2
10 2
2 11

output:

1
1
3
-2 3 -2
3
1 1 1
5
-3 4 -3 4 -3
5
1 -3 1 -3 1
7
4 -5 4 -5 4 -5 4
7
1 -3 1 -3 1 -3 1
9
-5 6 -5 6 -5 6 -5 6 -5
9
1 1 1 1 1 1 1 1 1
11
6 -7 6 -7 6 -7 6 -7 6 -7 6

result:

ok Ok

Test #15:

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

input:

10
12 2
2 13
14 2
2 15
2 16
17 2
18 2
19 2
20 2
21 2

output:

11
1 1 1 1 1 1 1 1 1 1 1
13
7 -8 7 -8 7 -8 7 -8 7 -8 7 -8 7
13
1 1 1 1 1 1 1 1 1 1 1 1 1
15
8 -9 8 -9 8 -9 8 -9 8 -9 8 -9 8 -9 8
15
1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1
17
-9 10 -9 10 -9 10 -9 10 -9 10 -9 10 -9 10 -9 10 -9
17
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
19
-10 11 -10 11 -10 11 -10 11 -10 11 -1...

result:

ok Ok

Test #16:

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

input:

10
2 22
2 23
2 24
2 25
26 2
2 27
28 2
2 29
30 2
31 2

output:

21
1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1
23
12 -13 12 -13 12 -13 12 -13 12 -13 12 -13 12 -13 12 -13 12 -13 12 -13 12 -13 12
23
1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1
25
13 -14 13 -14 13 -14 13 -14 13 -14 13 -14 13 -14 13 -14 13 -14 13 -14 13 -14 13 -14 13
25
1 1 1 1 1...

result:

ok Ok

Test #17:

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

input:

10
32 2
2 33
34 2
35 2
2 36
2 37
2 38
39 2
40 2
41 2

output:

31
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
33
17 -18 17 -18 17 -18 17 -18 17 -18 17 -18 17 -18 17 -18 17 -18 17 -18 17 -18 17 -18 17 -18 17 -18 17 -18 17 -18 17
33
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
35
-18 19 -18 19 -18 19 -18 19 -18 19 -18 19 -18...

result:

ok Ok

Test #18:

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

input:

10
2 42
43 2
2 44
45 2
46 2
2 47
48 2
2 49
50 2
2 51

output:

41
1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1
43
-22 23 -22 23 -22 23 -22 23 -22 23 -22 23 -22 23 -22 23 -22 23 -22 23 -22 23 -22 23 -22 23 -22 23 -22 23 -22 23 -22 23 -22 23 -22 23 -22 23 -22 23 -22
43
1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -...

result:

ok Ok

Test #19:

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

input:

10
2 1727
1728 2
1729 2
1730 2
1731 2
1732 2
2 1733
2 1734
2 1735
2 1736

output:

1727
864 -865 864 -865 864 -865 864 -865 864 -865 864 -865 864 -865 864 -865 864 -865 864 -865 864 -865 864 -865 864 -865 864 -865 864 -865 864 -865 864 -865 864 -865 864 -865 864 -865 864 -865 864 -865 864 -865 864 -865 864 -865 864 -865 864 -865 864 -865 864 -865 864 -865 864 -865 864 -865 864 -86...

result:

ok Ok

Test #20:

score: 0
Accepted
time: 10ms
memory: 15672kb

input:

10
2 8495
2 8496
2 8497
2 8498
8499 2
8500 2
2 8501
8502 2
8503 2
2 8504

output:

8495
4248 -4249 4248 -4249 4248 -4249 4248 -4249 4248 -4249 4248 -4249 4248 -4249 4248 -4249 4248 -4249 4248 -4249 4248 -4249 4248 -4249 4248 -4249 4248 -4249 4248 -4249 4248 -4249 4248 -4249 4248 -4249 4248 -4249 4248 -4249 4248 -4249 4248 -4249 4248 -4249 4248 -4249 4248 -4249 4248 -4249 4248 -424...

result:

ok Ok

Test #21:

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

input:

10
2 3989
2 3990
2 3991
2 3992
2 3993
3994 2
3995 2
3996 2
2 3997
2 3998

output:

3989
1995 -1996 1995 -1996 1995 -1996 1995 -1996 1995 -1996 1995 -1996 1995 -1996 1995 -1996 1995 -1996 1995 -1996 1995 -1996 1995 -1996 1995 -1996 1995 -1996 1995 -1996 1995 -1996 1995 -1996 1995 -1996 1995 -1996 1995 -1996 1995 -1996 1995 -1996 1995 -1996 1995 -1996 1995 -1996 1995 -1996 1995 -199...

result:

ok Ok

Test #22:

score: 0
Accepted
time: 19ms
memory: 15984kb

input:

10
9991 2
2 9992
2 9993
9994 2
9995 2
2 9996
2 9997
9998 2
9999 2
10000 2

output:

9991
-4996 4997 -4996 4997 -4996 4997 -4996 4997 -4996 4997 -4996 4997 -4996 4997 -4996 4997 -4996 4997 -4996 4997 -4996 4997 -4996 4997 -4996 4997 -4996 4997 -4996 4997 -4996 4997 -4996 4997 -4996 4997 -4996 4997 -4996 4997 -4996 4997 -4996 4997 -4996 4997 -4996 4997 -4996 4997 -4996 4997 -4996 499...

result:

ok Ok

Test #23:

score: 0
Accepted
time: 8ms
memory: 14980kb

input:

10
2 5682
5683 2
5684 2
2 5685
2 5686
5687 2
2 5688
2 5689
2 5690
2 5691

output:

5681
1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 1 -3 ...

result:

ok Ok

Subtask #3:

score: 14
Accepted

Test #24:

score: 14
Accepted
time: 0ms
memory: 16220kb

input:

10
7 1
1 5
1 1
10 1
1 4
3 1
1 6
1 2
1 9
8 1

output:

6
1 1 1 1 1 1
4
-1 -1 -1 -1
0
9
1 1 1 1 1 1 1 1 1
3
-1 -1 -1
2
1 1
5
-1 -1 -1 -1 -1
1
-1
8
-1 -1 -1 -1 -1 -1 -1 -1
7
1 1 1 1 1 1 1

result:

ok Ok

Test #25:

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

input:

10
6 2
2 4
2 2
2 5
3 2
7 2
2 10
2 1
2 8
2 9

output:

5
1 1 1 1 1
3
1 -3 1
1
1
5
3 -4 3 -4 3
3
-2 3 -2
7
-4 5 -4 5 -4 5 -4
9
1 -3 1 -3 1 -3 1 -3 1
1
1
7
1 -3 1 -3 1 -3 1
9
5 -6 5 -6 5 -6 5 -6 5

result:

ok Ok

Test #26:

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

input:

10
3 8
10 3
3 3
9 3
3 7
3 4
3 6
3 1
3 5
3 2

output:

9
-4 7 -4 -4 7 -4 -4 7 -4
11
-4 -4 9 -4 -4 9 -4 -4 9 -4 -4
2
1 1
8
1 1 1 1 1 1 1 1
8
3 3 -7 3 3 -7 3 3
5
2 2 -5 2 2
5
1 1 -5 1 1
2
1 1
6
-3 5 -3 -3 5 -3
3
-2 3 -2

result:

ok Ok

Test #27:

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

input:

10
1 4
8 4
9 4
7 4
4 6
2 4
4 4
4 3
4 10
5 4

output:

3
-1 -1 -1
7
1 1 1 1 1 1 1
11
-3 -3 -3 10 -3 -3 -3 10 -3 -3 -3
9
3 3 -8 3 3 3 -8 3 3
7
1 3 1 -7 1 3 1
3
1 -3 1
3
1 1 1
5
-2 -2 5 -2 -2
11
1 5 1 -9 1 5 1 -9 1 5 1
7
-2 -2 -2 7 -2 -2 -2

result:

ok Ok

Test #28:

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

input:

10
5 5
4 5
5 2
5 9
5 3
5 6
8 5
5 7
1 5
10 5

output:

4
1 1 1 1
7
2 2 2 -7 2 2 2
5
-3 4 -3 4 -3
12
-3 -3 -3 11 -3 -3 -3 -3 11 -3 -3 -3
6
3 -5 3 3 -5 3
9
2 2 2 2 -9 2 2 2 2
11
-5 8 -5 -5 8 -5 8 -5 -5 8 -5
10
-5 7 -5 7 -5 -5 7 -5 7 -5
4
-1 -1 -1 -1
9
1 1 1 1 1 1 1 1 1

result:

ok Ok

Test #29:

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

input:

10
1 6
6 9
10 6
4 6
2 6
6 5
7 6
3 6
6 6
6 8

output:

5
-1 -1 -1 -1 -1
11
1 1 4 1 1 -11 1 1 4 1 1
13
1 5 1 -11 1 5 1 5 1 -11 1 5 1
7
1 3 1 -7 1 3 1
5
1 -3 1 -3 1
9
-2 -2 -2 -2 9 -2 -2 -2 -2
11
-2 -2 -2 -2 -2 11 -2 -2 -2 -2 -2
5
1 1 -5 1 1
5
1 1 1 1 1
11
1 3 1 3 1 -11 1 3 1 3 1

result:

ok Ok

Test #30:

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

input:

10
5 7
4 7
7 8
7 7
1 7
7 9
7 2
3 7
10 7
7 6

output:

10
-5 7 -5 7 -5 -5 7 -5 7 -5
9
-3 -3 8 -3 -3 -3 8 -3 -3
13
2 2 2 2 2 2 -13 2 2 2 2 2 2
6
1 1 1 1 1 1
6
-1 -1 -1 -1 -1 -1
14
-7 9 -7 9 -7 9 -7 -7 9 -7 9 -7 9 -7
7
-4 5 -4 5 -4 5 -4
8
3 3 -7 3 3 -7 3 3
15
5 5 -12 5 5 -12 5 5 5 -12 5 5 -12 5 5
11
-2 -2 -2 -2 -2 11 -2 -2 -2 -2 -2

result:

ok Ok

Test #31:

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

input:

10
8 2
8 8
8 10
8 6
4 8
1 8
8 9
3 8
8 5
8 7

output:

7
1 1 1 1 1 1 1
7
1 1 1 1 1 1 1
15
1 3 1 3 1 3 1 -15 1 3 1 3 1 3 1
11
1 -5 1 -5 1 9 1 -5 1 -5 1
7
1 1 1 -7 1 1 1
7
-1 -1 -1 -1 -1 -1 -1
15
2 2 2 2 2 2 2 -15 2 2 2 2 2 2 2
9
-4 7 -4 -4 7 -4 -4 7 -4
11
-5 8 -5 -5 8 -5 8 -5 -5 8 -5
13
-2 -2 -2 -2 -2 -2 13 -2 -2 -2 -2 -2 -2

result:

ok Ok

Test #32:

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

input:

10
3 9
9 5
9 10
7 9
9 4
6 9
9 8
9 1
2 9
9 9

output:

8
1 1 -5 1 1 -5 1 1
12
3 3 3 -11 3 3 3 3 -11 3 3 3
17
2 2 2 2 2 2 2 2 -17 2 2 2 2 2 2 2 2
14
-7 9 -7 9 -7 9 -7 -7 9 -7 9 -7 9 -7
11
-3 -3 -3 10 -3 -3 -3 10 -3 -3 -3
11
1 1 4 1 1 -11 1 1 4 1 1
15
-2 -2 -2 -2 -2 -2 -2 15 -2 -2 -2 -2 -2 -2 -2
8
1 1 1 1 1 1 1 1
9
5 -6 5 -6 5 -6 5 -6 5
8
1 1 1 1 1 1 1 1

result:

ok Ok

Test #33:

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

input:

10
4 10
10 6
10 10
8 10
10 1
3 10
10 2
10 5
9 10
7 10

output:

11
1 5 1 -9 1 5 1 -9 1 5 1
13
1 5 1 -11 1 5 1 5 1 -11 1 5 1
9
1 1 1 1 1 1 1 1 1
15
1 3 1 3 1 3 1 -15 1 3 1 3 1 3 1
9
1 1 1 1 1 1 1 1 1
11
4 4 -9 4 4 -9 4 4 -9 4 4
9
1 1 1 1 1 1 1 1 1
9
1 1 1 1 1 1 1 1 1
17
2 2 2 2 2 2 2 2 -17 2 2 2 2 2 2 2 2
15
-5 -5 12 -5 -5 12 -5 -5 -5 12 -5 -5 12 -5 -5

result:

ok Ok

Subtask #4:

score: 15
Accepted

Test #34:

score: 15
Accepted
time: 0ms
memory: 15548kb

input:

10
2 3
2 4
4 3
5 3
5 4
6 4
6 5
5 7
7 6
6 8

output:

3
2 -3 2
3
1 -3 1
5
-2 -2 5 -2 -2
6
3 -5 3 3 -5 3
7
-2 -2 -2 7 -2 -2 -2
7
1 -5 1 5 1 -5 1
9
-2 -2 -2 -2 9 -2 -2 -2 -2
10
-5 7 -5 7 -5 -5 7 -5 7 -5
11
-2 -2 -2 -2 -2 11 -2 -2 -2 -2 -2
11
1 3 1 3 1 -11 1 3 1 3 1

result:

ok Ok

Test #35:

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

input:

10
8 7
7 9
8 9
8 10
10 9
11 9
11 10
10 12
12 11
13 11

output:

13
-2 -2 -2 -2 -2 -2 13 -2 -2 -2 -2 -2 -2
14
-7 9 -7 9 -7 9 -7 -7 9 -7 9 -7 9 -7
15
2 2 2 2 2 2 2 -15 2 2 2 2 2 2 2
15
1 3 1 3 1 3 1 -15 1 3 1 3 1 3 1
17
-2 -2 -2 -2 -2 -2 -2 -2 17 -2 -2 -2 -2 -2 -2 -2 -2
18
9 -11 9 -11 9 -11 9 -11 9 9 -11 9 -11 9 -11 9 -11 9
19
-2 -2 -2 -2 -2 -2 -2 -2 -2 19 -2 -2 -...

result:

ok Ok

Test #36:

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

input:

10
13 12
14 12
14 13
15 13
15 14
14 16
15 16
17 15
17 16
16 18

output:

23
-2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 23 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2
23
1 -5 1 -5 1 -5 1 -5 1 -5 1 21 1 -5 1 -5 1 -5 1 -5 1 -5 1
25
-2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 25 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2
26
13 -15 13 -15 13 -15 13 -15 13 -15 13 -15 13 13 -15 13 -15 13 -15 13 -15 13 -15 13 -15 ...

result:

ok Ok

Test #37:

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

input:

10
18 17
17 19
18 19
18 20
20 19
21 19
21 20
20 22
21 22
21 23

output:

33
-2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 33 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2
34
-17 19 -17 19 -17 19 -17 19 -17 19 -17 19 -17 19 -17 19 -17 -17 19 -17 19 -17 19 -17 19 -17 19 -17 19 -17 19 -17 19 -17
35
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 -35 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
...

result:

ok Ok

Test #38:

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

input:

10
23 22
22 24
23 24
25 23
24 25
26 24
26 25
25 27
27 26
26 28

output:

43
-2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 43 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2
43
1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 -43 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1
45
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 -45 2 2 2 2 2 2 2 2 2 2 2 2 2 ...

result:

ok Ok

Test #39:

score: 0
Accepted
time: 171ms
memory: 23156kb

input:

10
83402 83404
52908 52906
74520 74521
24222 24221
1082 1083
8982 8980
10142 10141
34908 34906
58179 58181
50841 50843

output:

166803
1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1...

result:

ok Ok

Test #40:

score: 0
Accepted
time: 167ms
memory: 23824kb

input:

10
20084 20083
10333 10331
98649 98648
72803 72804
40654 40655
1612 1614
26871 26873
5060 5062
60616 60615
6832 6830

output:

40165
-2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 ...

result:

ok Ok

Test #41:

score: 0
Accepted
time: 315ms
memory: 23212kb

input:

10
79524 79523
91096 91095
90747 90749
83462 83460
78387 78388
67918 67920
1682 1681
13180 13179
98702 98700
70766 70767

output:

159045
-2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2...

result:

ok Ok

Test #42:

score: 0
Accepted
time: 206ms
memory: 22396kb

input:

10
18052 18051
55715 55717
57933 57931
78574 78576
37241 37243
4851 4853
83373 83375
37863 37865
37892 37894
83822 83821

output:

36101
-2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 ...

result:

ok Ok

Test #43:

score: 0
Accepted
time: 138ms
memory: 20624kb

input:

10
2394 2392
24337 24339
55254 55256
46338 46339
11158 11159
20181 20182
59816 59818
15018 15020
39382 39381
33622 33623

output:

4783
1 -5 1 -5 1 -5 1 -5 1 -5 1 -5 1 -5 1 -5 1 -5 1 -5 1 -5 1 -5 1 -5 1 -5 1 -5 1 -5 1 -5 1 -5 1 -5 1 -5 1 -5 1 -5 1 -5 1 -5 1 -5 1 -5 1 -5 1 -5 1 -5 1 -5 1 -5 1 -5 1 -5 1 -5 1 -5 1 -5 1 -5 1 -5 1 -5 1 -5 1 -5 1 -5 1 -5 1 -5 1 -5 1 -5 1 -5 1 -5 1 -5 1 -5 1 -5 1 -5 1 -5 1 -5 1 -5 1 -5 1 -5 1 -5 1 -5 ...

result:

ok Ok

Test #44:

score: 0
Accepted
time: 225ms
memory: 23512kb

input:

10
13518 13517
67574 67576
76936 76938
73347 73349
7000 7001
19392 19391
6627 6626
24433 24432
98264 98265
94139 94141

output:

27033
-2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 ...

result:

ok Ok

Subtask #5:

score: 14
Accepted

Dependency #3:

100%
Accepted

Test #45:

score: 14
Accepted
time: 6ms
memory: 16212kb

input:

10
1476 492
1905 1143
1812 1812
1565 313
1362 908
370 740
1904 272
450 1800
1855 265
1352 1690

output:

1475
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

result:

ok Ok

Test #46:

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

input:

10
1020 1360
1242 1890
440 440
1506 753
347 347
183 1281
1888 944
354 1770
978 1304
1448 1991

output:

2039
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

result:

ok Ok

Test #47:

score: 0
Accepted
time: 5ms
memory: 15176kb

input:

10
1635 300
1920 960
780 1950
726 726
1235 1482
902 1804
1392 1392
1159 1647
1422 474
215 1720

output:

1919
1 1 1 1 1 1 1 1 1 1 1 1 1 1 -884 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1051 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -884 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1051 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -884 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1051 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -884 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1051 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -88...

result:

ok Ok

Test #48:

score: 0
Accepted
time: 6ms
memory: 15796kb

input:

10
1628 1628
1750 1274
1044 1566
954 477
1378 1378
1824 456
1540 462
1440 960
326 978
260 767

output:

1627
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

result:

ok Ok

Test #49:

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

input:

10
780 780
1708 1708
1519 868
972 1242
1028 771
1338 1561
134 268
1808 904
295 59
82 574

output:

779
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok Ok

Test #50:

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

input:

10
1134 1134
654 327
495 1980
766 383
1188 1188
1480 592
387 1641
1274 1274
710 1420
1662 1662

output:

1133
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

result:

ok Ok

Test #51:

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

input:

10
782 23
1064 1596
654 1308
798 399
1598 282
918 459
1152 1152
510 867
1820 260
1140 456

output:

781
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok Ok

Test #52:

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

input:

10
1540 1540
1560 1950
1295 259
582 388
1494 1992
586 586
372 682
1492 373
1512 945
1980 900

output:

1539
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

result:

ok Ok

Test #53:

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

input:

10
1734 918
1070 1712
1650 660
416 1248
1341 447
960 1760
304 1824
634 951
818 1227
1029 1029

output:

2549
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 205 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

result:

ok Ok

Test #54:

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

input:

10
777 259
924 1386
1560 780
327 327
1204 1204
988 741
404 1616
1952 1220
1062 1134
1719 764

output:

776
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok Ok

Test #55:

score: 0
Accepted
time: 8ms
memory: 14228kb

input:

10
2000 1215
2000 1280
897 2000
2000 1353
1268 2000
2000 1946
2000 1796
2000 1073
2000 1804
915 2000

output:

3209
1 1 1 1 856 1 1 1 1 856 1 1 1 1 -2359 1 1 1 1 856 1 1 1 1 856 1 1 1 1 856 1 1 1 1 -2359 1 1 1 1 856 1 1 1 1 856 1 1 1 1 856 1 1 1 1 -2359 1 1 1 1 856 1 1 1 1 856 1 1 1 1 -2359 1 1 1 1 856 1 1 1 1 856 1 1 1 1 856 1 1 1 1 -2359 1 1 1 1 856 1 1 1 1 856 1 1 1 1 856 1 1 1 1 -2359 1 1 1 1 856 1 1 1 1...

result:

ok Ok

Test #56:

score: 0
Accepted
time: 6ms
memory: 15576kb

input:

10
603 1999
825 1999
876 1999
1999 1783
731 1999
1999 1501
1217 1999
1999 1442
1999 1358
1593 1999

output:

2600
315 315 315 315 315 315 315 -2287 315 315 315 315 315 315 315 -2287 315 315 315 315 315 315 315 -2287 315 315 315 315 315 315 315 315 -2287 315 315 315 315 315 315 315 -2287 315 315 315 315 315 315 315 -2287 315 315 315 315 315 315 315 -2287 315 315 315 315 315 315 315 315 -2287 315 315 315 315...

result:

ok Ok

Test #57:

score: 0
Accepted
time: 8ms
memory: 14512kb

input:

10
1279 1998
1998 634
528 1998
1257 1998
1254 1998
1998 1414
1998 1991
1998 1861
938 1998
1991 1998

output:

3275
-474 -474 -474 -474 -474 2803 -474 -474 -474 -474 -474 -474 2803 -474 -474 -474 -474 -474 -474 2803 -474 -474 -474 -474 -474 -474 2803 -474 -474 -474 -474 -474 -474 2803 -474 -474 -474 -474 -474 -474 2803 -474 -474 -474 -474 -474 -474 2803 -474 -474 -474 -474 -474 -474 2803 -474 -474 -474 -474 ...

result:

ok Ok

Test #58:

score: 0
Accepted
time: 9ms
memory: 15248kb

input:

10
751 1997
1997 980
1997 1254
1927 1997
1015 1997
1997 1261
1119 1997
1997 1083
1441 1997
1997 1379

output:

2746
161 161 161 161 161 161 161 161 161 161 161 161 161 161 161 161 -2587 161 161 161 161 161 161 161 161 161 161 161 161 161 161 161 161 -2587 161 161 161 161 161 161 161 161 161 161 161 161 161 161 161 161 -2587 161 161 161 161 161 161 161 161 161 161 161 161 161 161 161 161 -2587 161 161 161 161...

result:

ok Ok

Test #59:

score: 0
Accepted
time: 8ms
memory: 14952kb

input:

10
1996 1506
1921 1996
1996 1996
1996 1649
1038 1996
1996 1115
1539 1996
1996 595
1996 853
1913 1996

output:

3499
1 -973 1 -973 1 2529 1 -973 1 -973 1 -973 1 2529 1 -973 1 -973 1 2529 1 -973 1 -973 1 -973 1 2529 1 -973 1 -973 1 -973 1 2529 1 -973 1 -973 1 2529 1 -973 1 -973 1 -973 1 2529 1 -973 1 -973 1 2529 1 -973 1 -973 1 -973 1 2529 1 -973 1 -973 1 -973 1 2529 1 -973 1 -973 1 2529 1 -973 1 -973 1 -973 1...

result:

ok Ok

Test #60:

score: 0
Accepted
time: 6ms
memory: 15836kb

input:

10
685 1995
1577 1995
1995 573
1995 1050
1587 1995
1507 1995
1742 1995
1995 1725
1995 1461
1995 794

output:

2674
1 1 1 1 1111 1 1 1 1 -1569 1 1 1 1 1111 1 1 1 1 -1569 1 1 1 1 1111 1 1 1 1 1111 1 1 1 1 -1569 1 1 1 1 1111 1 1 1 1 -1569 1 1 1 1 1111 1 1 1 1 1111 1 1 1 1 -1569 1 1 1 1 1111 1 1 1 1 -1569 1 1 1 1 1111 1 1 1 1 -1569 1 1 1 1 1111 1 1 1 1 1111 1 1 1 1 -1569 1 1 1 1 1111 1 1 1 1 -1569 1 1 1 1 1111 ...

result:

ok Ok

Test #61:

score: 0
Accepted
time: 9ms
memory: 15984kb

input:

10
1617 1994
1994 1687
1701 1994
1067 1994
1994 1922
1994 1474
1994 1187
1994 1405
1227 1994
1886 1994

output:

3609
795 795 795 -2816 795 795 795 795 -2816 795 795 795 -2816 795 795 795 795 -2816 795 795 795 -2816 795 795 795 795 -2816 795 795 795 -2816 795 795 795 795 -2816 795 795 795 -2816 795 795 795 795 -2816 795 795 795 -2816 795 795 795 795 -2816 795 795 795 795 -2816 795 795 795 -2816 795 795 795 795...

result:

ok Ok

Test #62:

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

input:

10
1898 1993
727 1993
1993 762
1404 1993
722 1993
1993 776
1993 967
1571 1993
1993 1247
1993 1869

output:

3889
-1925 1966 -1925 1966 -1925 1966 -1925 1966 -1925 1966 -1925 1966 -1925 1966 -1925 1966 -1925 1966 -1925 1966 -1925 1966 -1925 1966 -1925 1966 -1925 1966 -1925 1966 -1925 1966 -1925 1966 -1925 1966 -1925 1966 -1925 1966 -1925 1966 -1925 1966 -1925 1966 -1925 1966 -1925 1966 -1925 1966 -1925 196...

result:

ok Ok

Test #63:

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

input:

10
1992 1861
601 1992
1137 1992
1992 1647
1992 738
1992 1490
1808 1992
1527 1992
1730 1992
1992 1669

output:

3851
1000 1000 -2853 1000 1000 1000 -2853 1000 1000 1000 -2853 1000 1000 1000 -2853 1000 1000 1000 -2853 1000 1000 1000 -2853 1000 1000 -2853 1000 1000 1000 -2853 1000 1000 1000 -2853 1000 1000 1000 -2853 1000 1000 1000 -2853 1000 1000 1000 -2853 1000 1000 1000 -2853 1000 1000 -2853 1000 1000 1000 -...

result:

ok Ok

Test #64:

score: 0
Accepted
time: 9ms
memory: 14916kb

input:

10
1991 1256
1991 1716
984 1991
1991 928
1890 1991
1991 785
1991 1619
1808 1991
1058 1991
1991 1890

output:

3245
-349 -349 -349 -349 -349 -349 -349 -349 2898 -349 -349 -349 -349 -349 -349 -349 -349 2898 -349 -349 -349 -349 -349 -349 -349 -349 2898 -349 -349 -349 -349 -349 -349 -349 -349 -349 2898 -349 -349 -349 -349 -349 -349 -349 -349 2898 -349 -349 -349 -349 -349 -349 -349 -349 2898 -349 -349 -349 -349 ...

result:

ok Ok

Subtask #6:

score: 18
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #5:

100%
Accepted

Test #65:

score: 18
Accepted
time: 125ms
memory: 18260kb

input:

10
45595 41450
35430 42516
45331 45331
35412 44265
49448 44150
38904 38904
27456 45760
42064 41108
46207 46207
37224 45144

output:

82899
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok Ok

Test #66:

score: 0
Accepted
time: 148ms
memory: 18768kb

input:

10
34242 42144
43344 42140
49630 42540
42528 49616
43074 43074
34182 45576
49252 45734
33728 40052
48250 44390
48807 37323

output:

73751
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok Ok

Test #67:

score: 0
Accepted
time: 128ms
memory: 20132kb

input:

10
49088 49088
46908 41696
49230 41025
34534 43446
46988 38696
44205 41258
45528 40650
48698 46825
48195 41310
46210 46210

output:

49087
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok Ok

Test #68:

score: 0
Accepted
time: 98ms
memory: 18300kb

input:

10
37645 37645
35924 46188
29988 39984
36972 49296
34570 34570
46618 42380
35116 35116
38728 48410
31570 45100
38430 38430

output:

37644
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok Ok

Test #69:

score: 0
Accepted
time: 114ms
memory: 18508kb

input:

10
42672 42672
48095 38476
28668 47780
36636 49020
44985 35988
49596 45463
44928 46656
28580 35725
39370 43307
39228 39228

output:

42671
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok Ok

Test #70:

score: 0
Accepted
time: 106ms
memory: 19440kb

input:

10
36666 40740
38960 48700
45155 45155
37611 39402
49269 40311
49600 49600
39650 42700
41025 49230
38268 47835
43540 43540

output:

73331
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok Ok

Test #71:

score: 0
Accepted
time: 105ms
memory: 18344kb

input:

10
38291 41772
49365 49365
45295 45295
39270 44880
30490 42686
27159 36212
36099 45458
43956 43956
36388 36388
44135 35308

output:

76581
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok Ok

Test #72:

score: 0
Accepted
time: 102ms
memory: 19524kb

input:

10
41220 41220
30030 36036
35607 45318
42994 42994
34064 34064
42055 33644
49080 45808
28748 43122
30112 45168
34152 38421

output:

41219
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok Ok

Test #73:

score: 0
Accepted
time: 157ms
memory: 19452kb

input:

10
37316 46645
40470 33725
40358 48667
34122 45496
45034 48950
45808 49080
42536 49080
42444 47160
40080 32064
33460 41825

output:

74631
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok Ok

Test #74:

score: 0
Accepted
time: 106ms
memory: 19472kb

input:

10
44800 44800
44280 41328
34624 49772
37527 41101
37898 43312
38772 38772
36810 44172
40581 42084
38196 38196
42840 42840

output:

44799
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok Ok

Test #75:

score: 0
Accepted
time: 134ms
memory: 20152kb

input:

10
45592 45592
33475 48925
42738 49023
49472 37104
36491 42105
39694 48168
37816 47270
33872 48691
46624 40796
34400 41280

output:

45591
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok Ok

Test #76:

score: 0
Accepted
time: 125ms
memory: 18384kb

input:

10
48240 40200
45808 45808
37200 44640
45612 48870
47664 35748
48678 41724
36550 36550
36448 38726
47556 43593
44090 48499

output:

80399
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok Ok

Test #77:

score: 0
Accepted
time: 113ms
memory: 18320kb

input:

10
41888 41888
44560 44560
36477 48636
42775 42775
48510 45276
48202 39438
34452 43065
39120 45640
27684 46140
38619 47201

output:

41887
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok Ok

Test #78:

score: 0
Accepted
time: 96ms
memory: 19756kb

input:

10
43320 43320
37611 48357
31372 39215
37480 37480
34900 34900
46504 40691
37500 37500
41495 41495
47432 40376
44688 39102

output:

43319
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok Ok

Test #79:

score: 0
Accepted
time: 138ms
memory: 19924kb

input:

10
38340 46008
42336 44100
33600 44800
36485 36485
29528 36910
37458 49944
48464 43680
33088 41360
36070 43284
48084 48084

output:

76679
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok Ok

Test #80:

score: 0
Accepted
time: 335ms
memory: 19412kb

input:

10
49706 50000
50000 49651
50000 49252
49588 50000
50000 49361
49931 50000
49959 50000
49537 50000
50000 49361
50000 49939

output:

99703
1 29843 1 29843 1 -69863 1 29843 1 29843 1 -69863 1 29843 1 29843 1 29843 1 -69863 1 29843 1 29843 1 -69863 1 29843 1 29843 1 -69863 1 29843 1 29843 1 29843 1 -69863 1 29843 1 29843 1 -69863 1 29843 1 29843 1 -69863 1 29843 1 29843 1 29843 1 -69863 1 29843 1 29843 1 -69863 1 29843 1 29843 1 -6...

result:

ok Ok

Test #81:

score: 0
Accepted
time: 368ms
memory: 20136kb

input:

10
49999 49445
49999 49427
49685 49999
49668 49999
49999 49507
49999 49034
49999 49483
49795 49999
49011 49999
49617 49999

output:

99442
-49363 50081 -49363 50081 -49363 50081 -49363 50081 -49363 50081 -49363 50081 -49363 50081 -49363 50081 -49363 50081 -49363 50081 -49363 50081 -49363 50081 -49363 50081 -49363 50081 -49363 50081 -49363 50081 -49363 50081 -49363 50081 -49363 50081 -49363 50081 -49363 50081 -49363 50081 -49363 5...

result:

ok Ok

Test #82:

score: 0
Accepted
time: 299ms
memory: 19768kb

input:

10
49818 49998
49741 49998
49998 49736
49885 49998
49590 49998
49998 49345
49573 49998
49392 49998
49998 49935
49263 49998

output:

99809
1 1 1 1 1 43249 1 1 1 1 1 -56567 1 1 1 1 1 43249 1 1 1 1 1 -56567 1 1 1 1 1 43249 1 1 1 1 1 -56567 1 1 1 1 1 43249 1 1 1 1 1 43249 1 1 1 1 1 -56567 1 1 1 1 1 43249 1 1 1 1 1 -56567 1 1 1 1 1 43249 1 1 1 1 1 -56567 1 1 1 1 1 43249 1 1 1 1 1 43249 1 1 1 1 1 -56567 1 1 1 1 1 43249 1 1 1 1 1 -5656...

result:

ok Ok

Test #83:

score: 0
Accepted
time: 318ms
memory: 20444kb

input:

10
49829 49997
49997 49314
49714 49997
49215 49997
49143 49997
49997 49995
49997 49439
49997 49902
49532 49997
49997 49178

output:

99824
-2971 -2971 -2971 -2971 -2971 -2971 -2971 -2971 -2971 -2971 -2971 -2971 -2971 -2971 -2971 -2971 -2971 -2971 -2971 -2971 -2971 -2971 -2971 -2971 -2971 -2971 -2971 -2971 -2971 -2971 -2971 -2971 96855 -2971 -2971 -2971 -2971 -2971 -2971 -2971 -2971 -2971 -2971 -2971 -2971 -2971 -2971 -2971 -2971 ...

result:

ok Ok

Test #84:

score: 0
Accepted
time: 307ms
memory: 18984kb

input:

10
49996 49786
49648 49996
49273 49996
49850 49996
49929 49996
49996 49120
49241 49996
49623 49996
49305 49996
49872 49996

output:

99779
1 -12355 1 -12355 1 -12355 1 -12355 1 -12355 1 -12355 1 -12355 1 87427 1 -12355 1 -12355 1 -12355 1 -12355 1 -12355 1 -12355 1 -12355 1 87427 1 -12355 1 -12355 1 -12355 1 -12355 1 -12355 1 -12355 1 -12355 1 87427 1 -12355 1 -12355 1 -12355 1 -12355 1 -12355 1 -12355 1 -12355 1 87427 1 -12355 1...

result:

ok Ok

Test #85:

score: 0
Accepted
time: 278ms
memory: 19332kb

input:

10
49398 49995
49855 49995
49322 49995
49340 49995
49995 49834
49588 49995
49995 49098
49995 49783
49074 49995
49995 49437

output:

99389
1 1 -19481 1 1 -19481 1 1 -19481 1 1 -19481 1 1 79912 1 1 -19481 1 1 -19481 1 1 -19481 1 1 -19481 1 1 79912 1 1 -19481 1 1 -19481 1 1 -19481 1 1 -19481 1 1 79912 1 1 -19481 1 1 -19481 1 1 -19481 1 1 -19481 1 1 79912 1 1 -19481 1 1 -19481 1 1 -19481 1 1 -19481 1 1 79912 1 1 -19481 1 1 -19481 1 ...

result:

ok Ok

Test #86:

score: 0
Accepted
time: 297ms
memory: 19304kb

input:

10
49878 49994
49994 49210
49994 49047
49994 49581
49994 49810
49994 49632
49994 49567
49994 49654
49994 49237
49994 49877

output:

99869
1 1721 1 1721 1 1721 1 1721 1 1721 1 1721 1 1721 1 1721 1 1721 1 1721 1 1721 1 1721 1 1721 1 1721 1 1721 1 1721 1 1721 1 1721 1 1721 1 1721 1 1721 1 1721 1 1721 1 1721 1 1721 1 1721 1 1721 1 1721 1 1721 1 1721 1 1721 1 1721 1 1721 1 1721 1 1721 1 1721 1 1721 1 1721 1 1721 1 1721 1 1721 1 1721 ...

result:

ok Ok

Test #87:

score: 0
Accepted
time: 378ms
memory: 19612kb

input:

10
49993 49603
49993 49548
49927 49993
49993 49789
49993 49297
49376 49993
49993 49378
49993 49008
49993 49394
49327 49993

output:

99594
47755 -51841 47755 -51841 47755 -51841 47755 -51841 47755 -51841 47755 -51841 47755 -51841 47755 -51841 47755 -51841 47755 -51841 47755 -51841 47755 47755 -51841 47755 -51841 47755 -51841 47755 -51841 47755 -51841 47755 -51841 47755 -51841 47755 -51841 47755 -51841 47755 -51841 47755 -51841 47...

result:

ok Ok

Test #88:

score: 0
Accepted
time: 257ms
memory: 20188kb

input:

10
49269 49992
49992 49773
49992 49537
49992 49552
49992 49639
49560 49992
49040 49992
49620 49992
49402 49992
49974 49992

output:

99257
1 1 -25538 1 1 -25538 1 1 73723 1 1 -25538 1 1 -25538 1 1 -25538 1 1 73723 1 1 -25538 1 1 -25538 1 1 -25538 1 1 73723 1 1 -25538 1 1 -25538 1 1 -25538 1 1 73723 1 1 -25538 1 1 -25538 1 1 -25538 1 1 73723 1 1 -25538 1 1 -25538 1 1 -25538 1 1 73723 1 1 -25538 1 1 -25538 1 1 -25538 1 1 73723 1 1 ...

result:

ok Ok

Test #89:

score: 0
Accepted
time: 372ms
memory: 20428kb

input:

10
49991 49234
49991 49239
49430 49991
49991 49462
49596 49991
49309 49991
49536 49991
49537 49991
49943 49991
49991 49478

output:

99223
-34211 65014 -34211 -34211 65014 -34211 -34211 65014 -34211 -34211 65014 -34211 -34211 65014 -34211 -34211 65014 -34211 -34211 65014 -34211 -34211 65014 -34211 -34211 65014 -34211 -34211 65014 -34211 65014 -34211 -34211 65014 -34211 -34211 65014 -34211 -34211 65014 -34211 -34211 65014 -34211 -...

result:

ok Ok

Test #90:

score: 0
Accepted
time: 316ms
memory: 19508kb

input:

10
49990 49723
49990 49768
49990 49687
49990 49063
49803 49990
49990 49554
49960 49990
49990 49806
49383 49990
49627 49990

output:

99711
-13071 -13071 -13071 -13071 -13071 -13071 86642 -13071 -13071 -13071 -13071 -13071 -13071 -13071 86642 -13071 -13071 -13071 -13071 -13071 -13071 86642 -13071 -13071 -13071 -13071 -13071 -13071 -13071 86642 -13071 -13071 -13071 -13071 -13071 -13071 -13071 86642 -13071 -13071 -13071 -13071 -1307...

result:

ok Ok

Test #91:

score: 0
Accepted
time: 310ms
memory: 19344kb

input:

10
49804 49989
49989 49271
49989 49986
49586 49989
49789 49989
49989 49695
49007 49989
49526 49989
49989 49740
49989 49248

output:

99791
-10249 -10249 -10249 -10249 -10249 -10249 -10249 -10249 89544 -10249 -10249 -10249 -10249 -10249 -10249 -10249 -10249 -10249 89544 -10249 -10249 -10249 -10249 -10249 -10249 -10249 -10249 -10249 89544 -10249 -10249 -10249 -10249 -10249 -10249 -10249 -10249 89544 -10249 -10249 -10249 -10249 -102...

result:

ok Ok

Test #92:

score: 0
Accepted
time: 342ms
memory: 19292kb

input:

10
49155 49988
49988 49201
49988 49411
49298 49988
49505 49988
49997 49988
49988 49882
49988 49813
49988 49926
49988 49661

output:

99141
12378 12378 12378 12378 12378 12378 12378 -86765 12378 12378 12378 12378 12378 12378 12378 -86765 12378 12378 12378 12378 12378 12378 12378 -86765 12378 12378 12378 12378 12378 12378 12378 -86765 12378 12378 12378 12378 12378 12378 12378 -86765 12378 12378 12378 12378 12378 12378 12378 -86765 ...

result:

ok Ok

Test #93:

score: 0
Accepted
time: 307ms
memory: 20088kb

input:

10
49937 49987
49987 49553
49321 49987
49791 49987
49405 49987
49987 49107
49957 49987
49585 49987
49016 49987
49987 49688

output:

99922
-45965 53959 -45965 53959 -45965 53959 -45965 53959 -45965 53959 -45965 -45965 53959 -45965 53959 -45965 53959 -45965 53959 -45965 53959 -45965 53959 -45965 -45965 53959 -45965 53959 -45965 53959 -45965 53959 -45965 53959 -45965 53959 -45965 -45965 53959 -45965 53959 -45965 53959 -45965 53959 ...

result:

ok Ok

Test #94:

score: 0
Accepted
time: 291ms
memory: 18996kb

input:

10
49833 49986
49256 49986
49934 49986
49519 49986
49986 49855
49334 49986
49986 49406
49986 49315
49671 49986
49707 49986

output:

99809
1 1 1 1 1 1 1 1 41095 1 1 1 1 1 1 1 1 -58724 1 1 1 1 1 1 1 1 41095 1 1 1 1 1 1 1 1 -58724 1 1 1 1 1 1 1 1 41095 1 1 1 1 1 1 1 1 41095 1 1 1 1 1 1 1 1 -58724 1 1 1 1 1 1 1 1 41095 1 1 1 1 1 1 1 1 -58724 1 1 1 1 1 1 1 1 41095 1 1 1 1 1 1 1 1 41095 1 1 1 1 1 1 1 1 -58724 1 1 1 1 1 1 1 1 41095 1 1...

result:

ok Ok

Subtask #7:

score: 0
Time Limit Exceeded

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Dependency #6:

100%
Accepted

Test #95:

score: 24
Accepted
time: 315ms
memory: 26980kb

input:

10
72070 72070
103113 91656
172194 86097
89655 107586
111643 143541
111756 105257
111424 111424
189900 94950
136496 136496
195720 97860

output:

72069
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok Ok

Test #96:

score: 0
Accepted
time: 475ms
memory: 31296kb

input:

10
187168 99433
181147 132994
77040 154080
91302 182604
166755 155638
157950 94770
157425 94455
107916 143888
177210 196900
181024 181024

output:

280751
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

result:

ok Ok

Test #97:

score: 0
Accepted
time: 469ms
memory: 28952kb

input:

10
125755 114976
129145 145990
139005 166806
196626 131084
143600 98725
119643 159524
86968 130452
197316 131544
79502 198755
93198 186396

output:

237137
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

result:

ok Ok

Test #98:

score: 0
Accepted
time: 322ms
memory: 29304kb

input:

10
151576 75788
137316 91544
154470 77235
194292 122332
97150 145725
102288 115074
148083 148083
95550 127400
146820 146820
167770 167770

output:

151575
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

result:

ok Ok

Test #99:

score: 0
Accepted
time: 428ms
memory: 29220kb

input:

10
91950 137925
188152 141114
93108 186216
134232 121448
110592 92160
126720 168960
117095 163933
93240 186480
81684 163368
188321 80709

output:

183899
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

result:

ok Ok

Test #100:

score: 0
Accepted
time: 416ms
memory: 27420kb

input:

10
122135 142804
122830 122830
88840 199890
106305 124955
141770 99239
160305 128244
70754 176885
75696 126160
165966 110644
89500 143200

output:

263059
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

result:

ok Ok

Test #101:

score: 0
Accepted
time: 430ms
memory: 31652kb

input:

10
137481 183308
106110 141480
115143 153524
99168 99168
173507 167910
198583 113476
116109 77406
98752 148128
194514 194514
107613 166311

output:

274961
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

result:

ok Ok

Test #102:

score: 0
Accepted
time: 406ms
memory: 31444kb

input:

10
103192 193485
128184 164808
139440 139440
98365 98365
104742 163461
190960 190960
149387 149387
193060 106183
124869 83246
125456 172502

output:

283777
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

result:

ok Ok

Test #103:

score: 0
Accepted
time: 398ms
memory: 30376kb

input:

10
197730 121680
151088 151088
127888 191832
139872 192324
93423 93423
176640 122130
119889 154143
121190 121190
169479 94155
81942 81942

output:

304199
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

result:

ok Ok

Test #104:

score: 0
Accepted
time: 503ms
memory: 30908kb

input:

10
156706 142460
75555 100740
136374 194820
199918 136786
97674 146511
95898 183078
165330 192885
129096 164956
165210 165210
192816 192816

output:

284919
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

result:

ok Ok

Test #105:

score: 0
Accepted
time: 490ms
memory: 30912kb

input:

10
124359 82906
107130 89275
195648 163040
75338 75338
192855 102856
120196 120196
78480 196200
144300 177970
124032 195840
165120 196080

output:

165811
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

result:

ok Ok

Test #106:

score: 0
Accepted
time: 400ms
memory: 31292kb

input:

10
85482 170964
165222 119327
157962 157962
81771 81771
175797 190734
97654 97654
176275 160250
184756 184756
159590 127672
115080 115080

output:

170963
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

result:

ok Ok

Test #107:

score: 0
Accepted
time: 404ms
memory: 31004kb

input:

10
174328 174328
127890 170520
112263 149684
147690 98460
183035 183035
154485 154485
96165 128220
163296 176256
140658 195818
130722 174296

output:

174327
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

result:

ok Ok

Test #108:

score: 0
Accepted
time: 492ms
memory: 30320kb

input:

10
151368 191012
108800 149600
142448 178060
93546 93546
97780 195560
101830 173710
116688 145860
176890 163660
132212 99159
141324 188432

output:

338775
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

result:

ok Ok

Test #109:

score: 0
Accepted
time: 427ms
memory: 31520kb

input:

10
199680 176160
150465 120372
160544 185629
127964 127964
155166 103444
96732 193464
176768 176768
150138 125115
123426 123426
149835 119868

output:

375359
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

result:

ok Ok

Test #110:

score: 0
Accepted
time: 1933ms
memory: 32676kb

input:

10
200000 193880
200000 194742
200000 199658
199275 200000
195306 200000
200000 192727
200000 193253
200000 193548
200000 193963
200000 195354

output:

393839
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -64399 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -64399 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -64399 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok Ok

Test #111:

score: -24
Time Limit Exceeded

input:

10
199999 192586
193701 199999
196132 199999
190124 199999
192836 199999
193578 199999
199999 196684
199999 199644
199999 192549
197953 199999

output:

392583
33576 33576 33576 33576 33576 33576 33576 33576 33576 33576 -359009 33576 33576 33576 33576 33576 33576 33576 33576 33576 33576 33576 -359009 33576 33576 33576 33576 33576 33576 33576 33576 33576 33576 33576 -359009 33576 33576 33576 33576 33576 33576 33576 33576 33576 33576 -359009 33576 335...

result: