QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#323234#2006. ParrotsstompQ100 ✓2ms4220kbC++232.0kb2024-02-08 23:58:002024-02-08 23:58:00

Judging History

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

  • [2024-02-08 23:58:00]
  • 评测
  • 测评结果:100
  • 用时:2ms
  • 内存:4220kb
  • [2024-02-08 23:58:00]
  • 提交

encoder

#include <bits/stdc++.h>
#include "encoder.h"
#include "encoderlib.h"
using namespace std;
long long int f[55][55];
void encode(int N, int M[]) {
    for (int i = 0; i <= 35; i++) {
        for (int j = 0; j < 27; j++) {
            f[i][j] = 0;
            if (i == 0 && j == 0) f[i][j] = 1;
            if (i != 0) f[i][j] += f[i - 1][j];
            if (j != 0) f[i][j] += f[i][j - 1];
        }
    }
    int c = 0;
    for (int i = 0; i < N; i += 7) {
        long long int h = 0, k = 1, d = 0;
        for (int j = i; j < min(i + 7, N); j++) {
            h += 1ll * k * M[j];
            k *= 256;
            d++;
        }
        for (int j = d * 5; j >= 1; j--) {
            for (int k = 0; k < min(256 - c, 27); k++) {
                if (f[j][k] > h){
                    if (k != 0) h -= f[j][k - 1];
                    send(c + k);
                    break;
                }
            }
        }
        c += 27;
    }
}

decoder

#include <bits/stdc++.h>
#include "decoder.h"
#include "decoderlib.h"
using namespace std;
long long int f[55][55];
vector<int> g[10005];
void decode(int N, int L, int X[]) {
    for (int i = 0; i <= 35; i++) {
        for (int j = 0; j < 27; j++) {
            f[i][j] = 0;
            if (i == 0 && j == 0) f[i][j] = 1;
            if (i != 0) f[i][j] += f[i - 1][j];
            if (j != 0) f[i][j] += f[i][j - 1];
        }
    }
    for (int i = 0; i < N; i++) g[i].clear();
    for (int i = 0; i < L; i++) {
        g[X[i] / 27].push_back(X[i] % 27);
    }
    for (int i = 0; i < N; i++) {
        if (g[i].empty()) continue;
        sort(g[i].begin(), g[i].end());
        long long int c = 0;
        for (int j = g[i].size() - 1; j >= 0; j--) {
            int w = g[i][j];
            if (w != 0) {
                c += f[j + 1][w - 1];
            }
        }
        for (int j = i * 7; j < min((i + 1) * 7, N); j++) {
            output(c % 256);
            c /= 256;
        }
    }
}


詳細信息

Subtask #1:

score: 17
Accepted

Test #1:

score: 17
Accepted
time: 1ms
memory: 4184kb

input:

10
8 40
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 27 27 27 27 27 
8 40
28 27 27 27 27 20 19 19 19 18 18 18 18 17 17 15 15 15 14 11 10 9 9 8 7 7 6 6 6 6 6 6 5 5 4 2 1 1 0 0 
8 40
1 1 2 2 2 3 5 6 6 6 6 6 8 8 10 11 11 11 11 12 13 13 14 15 15 17 17 18 18 18 18 19 19 19 20 27 ...

output:

0 0 0 0 0 0 0 0 
1 1 1 1 1 1 1 1 
0 1 0 1 0 1 1 0 
0 1 0 1 0 1 1 0 
0 1 0 1 0 1 1 0 
1 0 0 1 0 1 1 0 
1 0 0 1 1 1 1 0 
1 0 0 1 1 1 1 0 
1 1 0 1 0 0 0 0 
1 1 0 1 0 0 0 0 

input:


output:

5.000000

result:

ok 

Subtask #2:

score: 17
Accepted

Test #2:

score: 17
Accepted
time: 1ms
memory: 4116kb

input:

50
8 40
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 27 27 27 27 27 
8 40
33 28 28 28 27 26 25 24 24 24 24 24 24 21 21 20 19 17 17 17 17 15 15 13 13 13 12 12 12 12 12 8 7 5 3 2 2 1 1 1 
8 40
1 1 1 2 2 3 5 7 8 12 12 12 12 12 13 13 13 15 15 17 17 17 17 19 20 21 21 24 24 24 24 ...

output:

0 0 0 0 0 0 0 0 
255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 
0 0 0 0 0 0 0 0 
243 109 222 210 112 222 171 178 
228 158 233 59 205 124 41 237 
155 180 90 45 173 60 66 172 
164 37 205 149 192 176 235 103 
95 7 200 68 93 112 112 236 
232 187 132 122 197 218 57 94 
245 69 229 217 2...

input:


output:

5.000000

result:

ok 

Test #3:

score: 17
Accepted
time: 2ms
memory: 4100kb

input:

50
11 55
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 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 
11 55
43 42 41 39 35 35 34 34 32 32 32 32 32 32 32 32 30 30 27 27 26 25 24 24 24 24 24 24 21 21 20 19 17 17 17 17 15 15 13 13 13 12 12 12 12 12 8 7 5 3 2 2 1 1 ...

output:

0 0 0 0 0 0 0 0 0 0 0 
255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 
0 0 0 0 0 0 0 0 0 0 0 
223 48 201 197 29 95 155 229 169 194 210 
82 128 14 63 9 120 170 54 242 202 80 
185 205 138 0 95 1 39 84 220 84 151 
181 154 208 54 30 17 25 13 215 50 209 
92 134 8...

input:


output:

5.000000

result:

ok 

Test #4:

score: 17
Accepted
time: 1ms
memory: 4160kb

input:

50
15 75
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 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 54 54 54 54 54 
15 75
60 55 55 55 54 53 52 51 51 51 51 51 51 48 48 47 46 44 44 44 44 42 42 40 40 40 39 39 39 39 39 3...

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
224 32 223 221 238 25 224 254 248 66 164 36 102 46 7 
33 26 6 162 138 31 204 225 175 131 134 45 51 142 6 
178 231 12...

input:


output:

5.000000

result:

ok 

Test #5:

score: 17
Accepted
time: 1ms
memory: 4060kb

input:

50
16 80
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 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 54 54 54 54 54 54 54 54 54 54 
16 80
63 62 62 62 60 56 55 55 54 54 53 52 51 51 51 51 51 51 48 48 47 46 44 44 44 44 4...

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
26 106 184 90 58 147 93 85 1 116 9 221 62 228 113 188 
51 58 213 192 113 132 214 231 184 129 103 227 111...

input:


output:

5.000000

result:

ok 

Subtask #3:

score: 18
Accepted

Test #6:

score: 18
Accepted
time: 0ms
memory: 4100kb

input:

50
8 40
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 27 27 27 27 27 
8 40
33 28 28 28 27 26 25 24 24 24 24 24 24 21 21 20 19 17 17 17 17 15 15 13 13 13 12 12 12 12 12 8 7 5 3 2 2 1 1 1 
8 40
1 1 1 2 2 3 5 7 8 12 12 12 12 12 13 13 13 15 15 17 17 17 17 19 20 21 21 24 24 24 24 ...

output:

0 0 0 0 0 0 0 0 
255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 
0 0 0 0 0 0 0 0 
243 109 222 210 112 222 171 178 
228 158 233 59 205 124 41 237 
155 180 90 45 173 60 66 172 
164 37 205 149 192 176 235 103 
95 7 200 68 93 112 112 236 
232 187 132 122 197 218 57 94 
245 69 229 217 2...

input:


output:

5.000000

result:

ok 

Test #7:

score: 18
Accepted
time: 0ms
memory: 4180kb

input:

50
11 55
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 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 
11 55
43 42 41 39 35 35 34 34 32 32 32 32 32 32 32 32 30 30 27 27 26 25 24 24 24 24 24 24 21 21 20 19 17 17 17 17 15 15 13 13 13 12 12 12 12 12 8 7 5 3 2 2 1 1 ...

output:

0 0 0 0 0 0 0 0 0 0 0 
255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 
0 0 0 0 0 0 0 0 0 0 0 
223 48 201 197 29 95 155 229 169 194 210 
82 128 14 63 9 120 170 54 242 202 80 
185 205 138 0 95 1 39 84 220 84 151 
181 154 208 54 30 17 25 13 215 50 209 
92 134 8...

input:


output:

5.000000

result:

ok 

Test #8:

score: 18
Accepted
time: 1ms
memory: 4080kb

input:

50
15 75
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 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 54 54 54 54 54 
15 75
60 55 55 55 54 53 52 51 51 51 51 51 51 48 48 47 46 44 44 44 44 42 42 40 40 40 39 39 39 39 39 3...

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
224 32 223 221 238 25 224 254 248 66 164 36 102 46 7 
33 26 6 162 138 31 204 225 175 131 134 45 51 142 6 
178 231 12...

input:


output:

5.000000

result:

ok 

Test #9:

score: 18
Accepted
time: 1ms
memory: 4216kb

input:

50
16 80
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 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 54 54 54 54 54 54 54 54 54 54 
16 80
63 62 62 62 60 56 55 55 54 54 53 52 51 51 51 51 51 51 48 48 47 46 44 44 44 44 4...

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
26 106 184 90 58 147 93 85 1 116 9 221 62 228 113 188 
51 58 213 192 113 132 214 231 184 129 103 227 111...

input:


output:

5.000000

result:

ok 

Subtask #4:

score: 29
Accepted

Test #10:

score: 29
Accepted
time: 0ms
memory: 4184kb

input:

50
8 40
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 27 27 27 27 27 
8 40
33 28 28 28 27 26 25 24 24 24 24 24 24 21 21 20 19 17 17 17 17 15 15 13 13 13 12 12 12 12 12 8 7 5 3 2 2 1 1 1 
8 40
1 1 1 2 2 3 5 7 8 12 12 12 12 12 13 13 13 15 15 17 17 17 17 19 20 21 21 24 24 24 24 ...

output:

0 0 0 0 0 0 0 0 
255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 
0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 
105 171 236 216 29 23 237 137 
133 238 133 208 208 161 99 228 
114 68 124 64 83 0 156 229 
107 234 136 136 175 106 239 229 
132 178 196 164 41 224 188...

input:


output:

5.000000

result:

ok 

Test #11:

score: 29
Accepted
time: 1ms
memory: 4160kb

input:

50
16 80
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 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 54 54 54 54 54 54 54 54 54 54 
16 80
63 62 62 62 60 56 55 55 54 54 53 52 51 51 51 51 51 51 48 48 47 46 44 44 44 44 4...

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
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 
188 66...

input:


output:

5.000000

result:

ok 

Test #12:

score: 29
Accepted
time: 1ms
memory: 4040kb

input:

50
20 100
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 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 
20 100
77 73 73 73 73 73...

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
0 0 0 0 0 0 0 0 ...

input:


output:

5.000000

result:

ok 

Test #13:

score: 29
Accepted
time: 1ms
memory: 4184kb

input:

50
30 150
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 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 81 81 81 8...

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 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 25...

input:


output:

5.000000

result:

ok 

Test #14:

score: 29
Accepted
time: 2ms
memory: 4084kb

input:

50
31 155
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 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 81 81 81 8...

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 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 ...

input:


output:

5.000000

result:

ok 

Test #15:

score: 29
Accepted
time: 2ms
memory: 4164kb

input:

50
32 160
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 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 81 81 81 8...

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 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 25...

input:


output:

5.000000

result:

ok 

Subtask #5:

score: 19
Accepted

Test #16:

score: 19
Accepted
time: 1ms
memory: 4160kb

input:

50
16 80
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 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 54 54 54 54 54 54 54 54 54 54 
16 80
63 62 62 62 60 56 55 55 54 54 53 52 51 51 51 51 51 51 48 48 47 46 44 44 44 44 4...

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
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 
214 69...

input:


output:

5.000000

result:

points 1.0

Test #17:

score: 19
Accepted
time: 1ms
memory: 4220kb

input:

50
32 160
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 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 81 81 81 8...

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 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 25...

input:


output:

5.000000

result:

points 1.0

Test #18:

score: 19
Accepted
time: 2ms
memory: 4160kb

input:

50
33 165
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 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 81 81 81 8...

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 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 ...

input:


output:

5.000000

result:

points 1.0

Test #19:

score: 19
Accepted
time: 2ms
memory: 4016kb

input:

50
50 250
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 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 81 81 81 8...

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 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255...

input:


output:

5.000000

result:

points 1.0

Test #20:

score: 19
Accepted
time: 2ms
memory: 4220kb

input:

50
60 300
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 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 81 81 81 8...

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 0 0 0 0 0 0 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255...

input:


output:

5.000000

result:

points 1.0

Test #21:

score: 19
Accepted
time: 2ms
memory: 4176kb

input:

50
63 315
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 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 81 81 81 8...

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 0 0 0 0 0 0 0 0 0 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 2...

input:


output:

5.000000

result:

points 1.0

Test #22:

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

input:

50
64 320
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 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 81 81 81 8...

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 0 0 0 0 0 0 0 0 0 0 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255...

input:


output:

5.000000

result:

points 1.0