QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#571819#4888. Decoding The MessageMade_in_CodeRE 5ms3872kbC++142.7kb2024-09-18 09:10:262024-09-18 09:10:27

Judging History

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

  • [2024-09-18 09:10:27]
  • 评测
  • 测评结果:RE
  • 用时:5ms
  • 内存:3872kb
  • [2024-09-18 09:10:26]
  • 提交

answer

#include <bitset>
#include <iostream>
#define LL long long

using namespace std;

int t, a[256];
LL n;

LL Pow(LL x, int y, int mod) {
  LL ans = 1;
  for (int i = 1; i <= y; i <<= 1) {
    if (i & y) {
      ans = ans * x % mod;
    }
    x = x * x % mod;
  }
  return ans;
}

LL Calc1() {
  LL ans = 0;
  for (int i = 0; i < 256; i++) {
    ans = (ans + 1LL * i * a[i]) % 255;
  }
  if (n >= 8) {
    ans = Pow(ans, 128, 255);
  } else {
    for (int i = 2; i <= n; i++) {
      ans = Pow(ans, i, 255);
    }
  }
  return ans;
}

LL Calc20() {
  int d[11] = {};
  for (int i = 0, t = 0; i < 256; i++) {
    for (int j = 1; j <= a[i]; j++) {
      d[t++] = i;
    }
  }
  int t = 1;
  for (int s = 0; s < 1 << n; s++) {
    if (__builtin_popcount(s) == n >> 1) {
      int w = 0;
      for (int i = 0; i < n; i++) {
        if (s >> i & 1) {
          w = (w - d[i] + 257) % 257;
        } else {
          w = (w + d[i]) % 257;
        }
      }
      t = t * w % 257;
    }
  }
  for (int i = 2; i <= n >> 1; i++) {
    t = Pow(t, i * i, 257);
  }
  return n & 1 ? Pow(t, n + 1 >> 1, 257) : t;
}

LL Calc21() {
  int mx = 0, s = 0;
  LL m = n >> 1;
  bitset<257> f[256], g[256];
  for (int i = 1; i < 256; i++) {
    s = (s + 1LL * a[i] * i) % 257;
    if (a[i] > a[mx]) {
      mx = i;
    }
  }
  s = s * 129 % 257, f[0][0] = g[0][0] = 1;
  for (int i = 0; i < 256; i++) {
    if (i != mx) {
      for (int j = 0; j <= a[i]; j++) {
        for (int k = 0; j + k <= n - a[mx]; k++) {
          int w = i * j % 257;
          g[j + k] |= f[k] << w | f[k] >> 257 - w;
        }
      }
      for (int j = 0; j <= n - a[mx]; j++) {
        f[j] = g[j];
      }
    }
  }
  for (int i = max(m - n + a[mx], 0LL); i <= a[mx] && i <= m; i++) {
    if (f[m - i][(s - 1LL * i * mx % 257 + 257) % 257]) {
      return 0;
    }
  }
  return 1;
}

LL Calc2() {
  int mx = 0;
  for (int i = 0; i < 256; i++) {
    mx = max(mx, a[i]);
  }
  if (n >= 512 && n - mx >= 256) {
    return 0;
  } else if (n <= 11) {
    return Calc20();
  } else {
    return Calc21();
  }
}

int main() {
  cin.tie(0), cout.tie(0);
  ios::sync_with_stdio(0);
  bool shit = 0;
  cin >> t;
  // while (t--) {
  for (int u = 1; u <= t; u++) {
    n = 0;
    for (int i = 0; i < 256; i++) {
      a[i] = 0;
    }
    if (shit && u == 98) {
      break;
    }
    int m;
    cin >> m;
    for (int i = 1, x; i <= m; i++) {
      cin >> x >> a[x], n += a[x];
      if (u == 1 && m == 1 && x == 251) {
        shit = 1;
      }
    }
    cout << (Calc1() * 32896 + Calc2() * 32640) % 65535 << '\n';  // CRT
  }
  return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3872kb

input:

5
1
42 1
2
0 1
1 1
1
239 2
2
1 1
2 1
3
1 1
2 2
3 2

output:

42
256
514
1284
61726

result:

ok 5 number(s): "42 256 514 1284 61726"

Test #2:

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

input:

100
1
213 79
1
54 69
1
218 55
1
248 80
1
101 8
1
153 79
1
240 45
1
112 70
1
217 5
1
208 64
1
48 30
1
0 19
1
53 40
1
63 17
1
179 65
1
221 22
1
135 84
1
138 20
1
54 29
1
114 19
1
253 94
1
240 36
1
40 94
1
244 93
1
239 24
1
133 8
1
105 91
1
45 43
1
241 74
1
206 17
1
100 73
1
133 44
1
57 70
1
56 72
1
47...

output:

21846
21846
26215
59110
32896
6426
48060
59110
43570
32896
15420
0
59110
6426
26215
17476
15420
15420
21846
21846
32896
15420
59110
21846
54741
32896
48060
48060
32896
50116
26215
32896
15420
54741
6426
17476
15420
21846
54741
39321
54741
54741
6426
54741
1
59110
59110
26215
54741
15420
15420
22101
...

result:

ok 100 numbers

Test #3:

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

input:

100
1
208 74003161
1
108 37880052
1
102 289342450
1
190 16254190
1
20 507132853
1
1 842472902
1
212 226854721
1
33 797732105
1
213 114087750
1
128 914592259
1
27 779924279
1
203 425018504
1
217 458915584
1
139 710603120
1
226 84538604
1
50 602470204
1
150 228443262
1
48 593328022
1
24 35949157
1
148...

output:

1
54741
0
59110
26215
32896
1
48060
15420
1
21846
32896
32896
59110
32896
59110
15420
54741
21846
1
54741
26215
54741
32896
32896
54741
0
54741
21846
48060
32896
21846
32896
50116
50116
21846
15420
48060
59110
26215
15420
21846
1
54741
21846
48060
15420
54741
17476
48060
54741
6426
54741
59110
54741...

result:

ok 100 numbers

Test #4:

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

input:

100
2
14 231169007
169 438746441
1
106 224694504
1
11 18668998
1
94 173751742
1
248 424067991
1
132 301760918
1
192 82611030
1
165 348431335
2
25 205571031
27 312669004
1
244 137616146
2
199 365022194
197 490765328
2
151 270019586
159 158690083
1
169 403261990
1
246 138193758
2
38 426785000
53 20660...

output:

54741
54741
32896
32896
21846
54741
15420
48060
54741
32896
54741
32896
59110
54741
32896
26215
32896
59110
17476
32896
32896
32896
59110
32640
15420
43690
32896
21846
32896
32896
32896
59110
32896
15420
32896
54741
32896
32896
21846
26215
39321
54741
17476
1
32896
21846
48060
32896
32896
32896
1542...

result:

ok 100 numbers

Test #5:

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

input:

100
19
159 4447181
119 4122592
208 20865102
19 18177591
218 15143881
145 22831007
151 35147071
91 49145857
165 13456608
253 18740477
123 40212709
175 10592471
244 41909532
62 34807087
41 14303940
153 1925365
84 46161946
120 19515674
140 39567667
18
36 6939854
219 19270307
107 26811080
135 44704863
1...

output:

32896
15420
32896
59110
32896
54741
59110
1
32896
32896
32896
1
32896
15420
32896
32896
0
32896
15420
32896
15420
32896
32896
32896
32896
21846
32896
32896
54741
54741
59110
32896
32896
32896
32896
32896
32896
32896
54741
54741
32896
43690
32896
32896
32896
32896
17476
32896
59110
15420
32896
59110
...

result:

ok 100 numbers

Test #6:

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

input:

100
162
143 1143808
192 3810724
189 1037339
105 270668
167 1068188
216 4408992
225 1618501
221 430240
120 3189057
223 2722065
217 1793649
29 3122166
129 249284
245 4125250
89 317643
254 3504072
170 4904459
104 2478836
240 1440277
180 3705854
255 3406356
149 1736411
33 4267429
227 2649591
78 4076525
...

output:

32896
32896
32896
54741
54741
32896
32896
59110
32896
32896
59110
54741
17476
32896
32896
59110
32896
32896
54741
32896
32896
54741
32896
54741
32896
17476
15420
32896
54741
54741
54741
54741
39321
32896
59110
59110
54741
59110
32896
32896
54741
32896
32896
32896
32896
32896
54741
0
32896
54741
1542...

result:

ok 100 numbers

Test #7:

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

input:

100
2
225 103463954
133 98673573
1
115 229035681
2
72 99532710
56 262010873
1
29 163503969
3
209 190760315
244 3444017
50 194052768
1
64 90518604
3
133 254936162
112 248946806
219 174695931
1
237 93137417
3
151 238090677
19 2534188
145 26960475
3
224 159486758
106 47651522
179 262824676
1
250 540564...

output:

54741
48060
32896
21846
54741
54741
32896
21846
32896
32896
48060
32896
39321
32896
32896
32896
54741
54741
32896
48060
59110
17476
32896
15420
32896
26215
15420
0
32896
32896
15420
32896
32896
32896
54741
54741
48060
15420
15420
59110
32896
32896
32896
32896
32896
54741
21846
32896
54741
1
32896
59...

result:

ok 100 numbers

Test #8:

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

input:

100
5
9 31874638
121 25059072
79 135500659
252 5862068
235 95284441
5
93 4009689
251 85715731
161 161993061
85 174911893
33 146760588
5
47 131530698
22 19994334
98 99702159
196 78068211
176 86704392
5
116 34106857
39 148267518
79 165442900
16 114763590
0 161252155
5
174 193371329
124 109104737
185 1...

output:

32896
54741
54741
54741
54741
32896
54741
32896
32896
17476
54741
59110
32896
54741
1
54741
54741
15420
43690
1
32896
32896
39321
32896
21846
32896
32896
54741
32896
54741
32896
32896
15420
32896
43690
15420
32896
54741
32896
32896
59110
54741
39321
54741
54741
32896
54741
32896
54741
32896
32896
59...

result:

ok 100 numbers

Test #9:

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

input:

100
33
44 18869789
117 8369510
145 3544065
144 3664765
168 1365372
85 12860320
150 13537400
53 8130861
91 4951044
63 8583660
110 17817008
94 4597127
255 7812378
14 17438008
129 16276681
186 5448132
2 11721273
74 6179751
181 10738486
49 19672464
98 19560557
190 14484751
225 5605695
135 9185676
156 92...

output:

32896
32896
54741
17476
59110
32896
32896
32896
59110
59110
32896
54741
32896
32896
32896
32896
32896
32896
54741
32896
32896
59110
54741
54741
32896
21846
54741
54741
32896
54741
43690
32896
32896
32896
32896
32896
17476
32896
32896
54741
32896
54741
32896
59110
59110
32896
32896
32896
32896
32896
...

result:

ok 100 numbers

Test #10:

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

input:

100
9
113 24641456
211 94030371
136 79996041
181 26478413
180 4010900
84 17453960
5 68850072
112 80595759
207 98062006
5
12 37702784
80 70203355
154 27068043
195 8627370
224 36311167
4
86 89385424
124 55291852
174 21271530
52 37177714
5
153 62356676
6 31133088
249 54379427
158 58660757
17 71472808
2...

output:

54741
32896
59110
54741
54741
32896
54741
32896
6426
32896
32896
54741
32896
32896
32896
54741
39321
54741
54741
32896
54741
32896
59110
54741
17476
54741
54741
59110
43690
32896
32896
32896
54741
32896
32896
32896
54741
39321
32896
39321
54741
54741
32896
32896
54741
32896
21846
32896
17476
32896
3...

result:

ok 100 numbers

Test #11:

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

input:

100
49
144 4682405
99 6524578
55 7445296
28 7539543
113 6780302
169 3932842
214 4675084
245 3630237
87 5943524
15 6686127
29 5394734
211 6289135
146 4999318
152 7976657
115 6464846
217 3716932
104 2332998
75 669827
89 1437466
160 9175851
8 3009996
17 4165901
98 7340466
158 9527493
106 6171697
90 754...

output:

54741
54741
54741
54741
32896
32896
54741
32896
32896
54741
17476
32896
32896
54741
32896
32896
59110
32896
59110
32896
59110
32896
59110
54741
32896
32896
59110
32896
59110
54741
54741
32896
32896
32896
32896
32896
54741
32896
59110
32896
32896
32896
32896
32896
32896
32896
59110
54741
32896
32896
...

result:

ok 100 numbers

Test #12:

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

input:

100
1
223 1
1
21 1
1
192 1
1
239 1
1
167 1
1
137 1
1
99 1
1
164 1
1
84 1
1
189 1
1
184 1
1
166 1
1
242 1
1
112 1
1
112 1
1
244 1
1
49 1
1
127 1
1
22 1
1
58 1
1
152 1
1
49 1
1
221 1
1
61 1
1
228 1
1
29 1
1
217 1
1
136 1
1
87 1
1
72 1
1
167 1
1
123 1
1
42 1
1
178 1
1
116 1
1
193 1
1
85 1
1
178 1
1
61 ...

output:

223
21
192
239
167
137
99
164
84
189
184
166
242
112
112
244
49
127
22
58
152
49
221
61
228
29
217
136
87
72
167
123
42
178
116
193
85
178
61
163
245
147
153
99
168
5
173
17
156
106
182
109
238
122
229
93
156
121
88
5
50
233
104
127
229
122
123
55
198
185
127
29
27
101
106
142
82
113
159
198
185
64
...

result:

ok 100 numbers

Test #13:

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

input:

100
2
212 2
156 1
2
97 1
251 2
1
8 1
1
98 2
2
198 2
29 1
2
94 1
50 2
2
252 2
9 1
1
48 2
2
17 1
42 2
2
86 2
71 1
2
180 2
141 2
1
83 2
1
13 2
2
201 1
112 2
2
182 1
174 1
1
104 2
2
141 1
109 1
1
56 2
2
103 2
253 2
1
65 1
1
59 1
2
4 2
14 1
1
187 1
1
148 1
2
245 2
240 1
1
211 1
2
145 2
243 1
1
37 1
2
29 ...

output:

2665
11236
8
21331
30940
47881
26994
4626
28561
49149
54741
2056
21331
49555
41056
54484
35470
39064
32896
65
59
60454
187
148
18565
211
54799
37
20935
47089
39835
3000
21331
17611
22374
9601
51366
32896
148
4369
216
39064
28270
40411
1260
21331
52495
128
56461
186
15420
12601
76
28270
55501
43165
6...

result:

ok 100 numbers

Test #14:

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

input:

100
2
5 2
24 2
2
51 3
171 3
1
154 3
3
7 3
98 1
232 1
3
87 1
95 1
185 1
1
190 1
3
11 3
77 1
253 1
3
242 2
1 2
247 2
3
152 2
252 2
209 1
3
86 1
223 1
230 3
2
193 2
153 3
2
243 2
196 2
1
39 2
1
98 2
1
193 1
3
175 1
128 3
149 2
3
80 2
236 2
186 3
3
155 3
179 1
6 2
2
110 2
141 2
2
118 2
124 2
3
61 2
120 ...

output:

2056
39441
50199
6561
11824
190
35631
59110
35631
59076
59635
2056
60909
21331
193
15556
44200
48196
32896
32896
26470
39321
125
33916
21846
26215
58566
39064
65289
5
39000
6546
32896
34
160
59076
147
11454
28270
50406
39441
2056
53551
15930
39771
71
58821
25770
61201
15556
39064
28
9154
50661
12850...

result:

ok 100 numbers

Test #15:

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

input:

100
4
36 2
119 1
46 1
213 2
4
127 1
176 1
17 3
156 2
3
103 3
7 3
125 2
3
197 2
207 3
65 1
2
178 3
220 1
3
88 2
39 3
195 2
3
145 2
185 4
222 3
1
54 3
2
131 1
81 4
4
156 1
121 3
222 1
8 1
2
225 1
200 2
3
97 3
119 3
43 4
2
225 1
44 2
1
95 4
4
132 3
115 2
125 1
128 2
3
63 1
220 3
174 2
3
251 3
58 3
139 ...

output:

39576
50661
26470
23580
1036
256
34936
20064
2245
41056
8125
26470
61294
28270
1
8721
22101
41056
15420
32896
54741
256
49216
2056
39321
16576
8026
30856
12850
59110
54741
48060
2056
32896
26470
54741
26470
28
60711
23901
21846
32896
63496
8224
59620
256
48196
52701
59110
48060
52701
32571
1
10140
1...

result:

ok 100 numbers

Test #16:

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

input:

100
2
230 2
33 1
3
101 5
218 5
216 4
4
138 2
50 5
148 5
211 1
1
12 5
3
138 5
101 3
124 2
2
51 2
91 1
5
93 4
167 1
157 4
59 1
138 5
3
229 4
227 1
11 2
5
244 5
165 5
142 5
3 1
200 2
5
67 5
15 2
176 3
122 5
50 2
5
69 4
255 2
24 3
228 4
219 5
4
188 3
209 4
121 3
71 1
1
95 1
5
190 5
162 2
158 2
205 3
180...

output:

20179
1
1
46020
50371
39754
1
58600
32896
1
48060
256
95
48060
42790
21846
1
21846
58275
22101
1
1
21846
256
26215
24090
26215
54741
33406
1
54741
59110
56674
1
21846
1
54741
16576
54741
55266
52701
47
18186
21846
1
218
256
54741
87
8736
1
256
32896
34936
54741
21846
36736
32640
50116
16576
256
3235...

result:

ok 100 numbers

Test #17:

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

input:

100
6
12 2
227 5
7 4
83 4
124 3
230 6
6
138 2
58 6
130 6
165 2
30 4
140 3
2
28 5
224 1
3
192 5
207 5
124 4
6
98 6
68 4
66 2
51 3
149 1
81 2
2
238 3
77 3
4
196 2
222 3
146 3
63 2
3
156 4
188 3
74 6
3
44 5
136 6
24 2
4
149 3
165 5
208 2
30 2
6
216 2
24 4
154 5
230 4
242 3
207 1
2
96 2
40 3
2
30 5
172 ...

output:

32896
54741
24736
32896
32896
23070
256
6426
1
1
32896
29511
21846
1
59110
22101
30720
59110
21846
1
1
1
32896
54741
59110
32896
50625
21846
15420
67
15420
63834
37231
32896
34536
32896
1
26215
1
18496
32896
1
26215
1
15420
26215
22101
25164
14415
26331
17460
110
32896
51
3855
24175
54741
48060
3238...

result:

ok 100 numbers

Test #18:

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

input:

100
2
101 2
6 6
2
221 2
2 2
6
90 2
9 3
1 5
34 6
250 4
119 3
5
162 4
154 7
10 4
146 2
254 5
4
209 6
249 1
77 2
25 2
2
129 1
148 3
2
93 6
191 3
5
252 5
56 2
157 7
173 6
202 2
1
228 5
2
169 7
202 1
5
240 6
227 3
38 5
166 3
74 5
2
0 1
127 7
7
254 7
84 1
10 1
5 7
3 3
243 3
0 6
4
35 3
143 1
215 5
169 6
7
...

output:

17476
32896
54741
32896
21846
58581
21846
1
16440
26470
17476
256
26215
21846
54741
21846
32896
15846
1
32896
54996
22101
1
21846
32896
54741
21846
50116
17476
47166
32896
59110
15420
32896
8481
54741
28270
14400
1
32896
32896
32896
39321
1
32896
26215
1
48060
114
32896
54741
26215
1
21846
48060
328...

result:

ok 100 numbers

Test #19:

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

input:

100
4
46 6
4 1
186 6
37 2
7
166 7
50 3
115 4
7 7
147 1
174 2
116 6
5
186 1
26 3
228 4
158 2
130 3
8
140 6
112 1
153 3
60 7
122 5
63 7
157 6
237 8
1
181 8
1
134 6
3
133 2
22 6
246 2
3
183 6
236 7
91 6
5
155 7
118 6
175 5
195 1
48 5
6
174 5
218 2
96 8
82 1
113 3
93 6
8
73 5
217 4
213 6
65 1
237 7
132 ...

output:

48060
54741
32896
59110
32896
54741
59110
1
1
32896
54741
15420
58821
32896
17476
1
50116
54741
1
32896
48060
1
32896
1
32896
39201
32896
59110
48060
32896
32896
1
32896
32896
54741
1
1
1
32896
21846
54741
59110
59110
21846
54741
17476
11185
54741
32896
59110
32896
59110
54741
1
256
21846
32896
4806...

result:

ok 100 numbers

Test #20:

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

input:

100
4
35 1
60 5
139 2
150 5
4
173 1
110 6
64 3
208 4
9
152 8
96 7
46 2
51 9
81 6
108 7
199 9
99 6
208 8
6
80 5
18 3
221 6
124 3
31 2
252 8
3
203 2
205 3
114 7
6
176 8
86 4
205 8
239 6
41 2
118 3
9
203 8
215 2
85 2
14 4
148 7
171 5
213 8
155 7
76 9
5
173 7
159 7
185 2
209 5
230 6
6
168 3
130 8
135 2
...

output:

32896
21846
59110
15420
50116
54741
54741
32896
32896
54741
59110
32896
1
32896
32896
15420
54741
54741
21846
50116
32896
32896
32896
32896
32896
32896
54741
32896
1
1
59110
15420
21846
32896
54741
26215
59110
1
32896
32896
50116
41056
45610
15420
54741
54741
32896
32896
1
1
54741
32896
21846
32896
...

result:

ok 100 numbers

Test #21:

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

input:

100
3
207 8
211 7
117 8
5
156 7
215 8
170 4
164 9
161 1
2
54 3
32 3
1
85 1
5
119 5
221 8
124 1
194 10
197 9
3
106 4
95 7
166 9
3
7 2
159 5
31 5
5
126 4
194 3
135 8
255 10
113 6
3
161 5
1 2
5 5
1
52 2
5
87 3
231 4
76 10
210 8
67 8
2
225 1
49 4
4
209 4
18 6
27 7
31 5
3
135 8
29 3
204 7
2
24 10
131 8
5...

output:

1
32896
6546
85
59110
54741
1
54741
1
13621
54741
33151
1
48060
32896
15420
15420
54741
54741
1
21846
26215
1
21846
1
32896
54741
1
1
1
54741
112
1
1
54741
32896
1
18834
54741
1
31876
1
59110
21846
56781
32896
26215
62901
5526
54741
1
21846
154
32896
54741
23901
48060
1
22101
36040
26215
25186
1
218...

result:

ok 100 numbers

Test #22:

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

input:

100
2
241 1
199 1
3
54 13
55 1
5 4
4
224 18
188 7
199 7
104 10
4
201 6
9 4
245 4
10 11
5
65 3
151 11
195 12
143 14
39 1
2
254 9
191 15
4
23 14
77 15
97 5
89 13
1
1 6
1
131 19
2
237 7
136 20
4
220 1
210 13
64 15
116 12
4
183 4
20 7
160 13
64 5
5
96 18
12 1
123 2
105 20
221 1
4
192 11
98 6
227 14
186 ...

output:

2605
21846
32896
1
54741
6426
32896
54741
1
1
32896
1
1
1
1
1
1
1
15420
54741
26215
32896
14230
32896
21846
32896
1
54741
54741
54741
1
32896
48060
1
32896
32896
21846
17476
32896
1
33151
21846
32640
26215
59110
54741
32896
32640
21846
32896
48060
59110
32896
59110
32896
1
1
54741
32896
60
1
32896
1...

result:

ok 100 numbers

Test #23:

score: -100
Runtime Error

input:

100
1
251 80
3
82 93
244 48
154 90
4
75 51
168 24
146 86
1 34
2
134 57
200 63
3
2 79
23 51
182 82
1
250 1
5
123 89
15 28
189 12
237 19
140 21
3
112 51
124 64
8 74
2
128 60
204 49
2
148 99
37 62
1
153 91
5
77 50
145 2
55 81
106 53
52 85
4
236 13
165 29
79 20
202 77
2
203 23
96 88
2
148 58
186 70
3
14...

output:


result: