QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#663352#8705. 圣遗物peaneval_kala100 ✓200ms5096kbC++2310.8kb2024-10-21 14:59:012024-10-21 14:59:02

Judging History

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

  • [2024-10-21 14:59:02]
  • 评测
  • 测评结果:100
  • 用时:200ms
  • 内存:5096kb
  • [2024-10-21 14:59:01]
  • 提交

answer

#pragma GCC optimize(3, "unroll-loops", "no-stack-protector")
#define atsum(l, r) accumulate(l, r, 0)
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/hash_policy.hpp>
using namespace std;
using ll = long long;
using ull = unsigned long long;
constexpr int inf = 0x3f3f3f3f;
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
template <typename T>
inline void chkmin(T &x, T y) { x = min(x, y); }
template <typename T>
inline void chkmax(T &x, T y) { x = max(x, y); }
namespace FastIO
{
// ------------------------------
#define IN_HAS_NEG
#define OUT_HAS_NEG
#define CHK_EOF
#define DISABLE_MMAP
// ------------------------------
#if __cplusplus < 201400
#error Please use C++14 or higher.
#endif
#if __cplusplus > 201700
#define INLINE_V inline
#else
#define INLINE_V
#endif
#if ( defined(LOCAL) || defined (_WIN32) ) && !defined(DISABLE_MMAP)
#define DISABLE_MMAP
#endif
#ifndef DISABLE_MMAP
#include<sys/mman.h>
#endif
#ifdef LOCAL
    inline char gc() { return getchar(); }
    inline void pc(char c) { putchar(c); }
#else
#ifdef DISABLE_MMAP
    INLINE_V constexpr int _READ_SIZE = 1 << 18;
    INLINE_V static char _read_buffer[_READ_SIZE], *_read_ptr = nullptr, *_read_ptr_end = nullptr;
    inline char gc()
    {
        if ( __builtin_expect(_read_ptr == _read_ptr_end, false) )
        {
            _read_ptr = _read_buffer;
            _read_ptr_end = _read_buffer + fread(_read_buffer, 1, _READ_SIZE, stdin);
#ifdef CHK_EOF
            if ( __builtin_expect(_read_ptr == _read_ptr_end, false) ) return EOF;
#endif
        }
        return *_read_ptr++;
    }
#else
    INLINE_V static const char *_read_ptr = (const char *)mmap(nullptr, INT_MAX, 1, 2, 0, 0);
    inline char gc() { return *_read_ptr++; }
#endif
    INLINE_V constexpr int _WRITE_SIZE = 1 << 18;
    INLINE_V static char _write_buffer[_WRITE_SIZE], *_write_ptr = _write_buffer;
    inline void pc(char c)
    {
        *_write_ptr++ = c;
        if ( __builtin_expect(_write_buffer + _WRITE_SIZE == _write_ptr, false) )
        {
            fwrite(_write_buffer, 1, _write_ptr - _write_buffer, stdout);
            _write_ptr = _write_buffer;
        }
    }
    INLINE_V struct _auto_flush
    {
        ~_auto_flush() { fwrite(_write_buffer, 1, _write_ptr - _write_buffer, stdout); }
    }	_auto_flush;
#endif
#ifdef CHK_EOF
    inline bool _isdigit(char c) { return ( c & 16 ) && c != EOF; }
    inline bool _isgraph(char c) { return c > 32 && c != EOF; }
#else
    inline bool _isdigit(char c) { return c & 16; }
    inline bool _isgraph(char c) { return c > 32; }
#endif
    template < class T >
    INLINE_V constexpr bool _is_integer = numeric_limits < T >::is_integer;
    template < class T >
    INLINE_V constexpr bool _is_signed = numeric_limits < T >::is_signed;
    template < class T >
    INLINE_V constexpr bool _is_unsigned = _is_integer < T > && !_is_signed < T >;
    template <> INLINE_V constexpr bool _is_integer < __int128 > = true;
    template <> INLINE_V constexpr bool _is_integer < __uint128_t > = true;
    template <> INLINE_V constexpr bool _is_signed < __int128 > = true;
    template <> INLINE_V constexpr bool _is_unsigned < __uint128_t > = true;
#undef INLINE_V
    inline void read(char &c) { do c = gc(); while ( !_isgraph(c) ); }
    inline void read_cstr(char *s)
    {
        char c = gc(); while ( !_isgraph(c) ) c = gc();
        while ( _isgraph(c) ) *s++ = c, c = gc();
        *s = 0;
    }
    inline void read(string &s)
    {
        char c = gc(); s.clear(); while ( !_isgraph(c) ) c = gc();
        while ( _isgraph(c) ) s.push_back(c), c = gc();
    }
#ifdef IN_HAS_NEG
    template < class T, enable_if_t < _is_signed < T >, int > = 0 >
    inline void read(T &x)
    {
        char c = gc(); bool f = true; x = 0;
        while ( !_isdigit(c) ) { if ( c == 45 ) f = false; c = gc(); }
        if ( f ) while ( _isdigit(c) ) x = x * 10 + ( c & 15 ), c = gc();
        else     while ( _isdigit(c) ) x = x * 10 - ( c & 15 ), c = gc();
    }
    template < class T, enable_if_t < _is_unsigned < T >, int > = 0 >
#else
    template < class T, enable_if_t < _is_integer < T >, int > = 0 >
#endif
    inline void read(T &x)
    {
        char c = gc(); while ( !_isdigit(c) ) c = gc();
        x = 0; while ( _isdigit(c) ) x = x * 10 + ( c & 15 ), c = gc();
    }
    inline void write(char c) { pc(c); }
    inline void write_cstr(const char *s) { while ( *s ) pc(*s++); }
    inline void write(const string &s) { for ( char c : s ) pc(c); }
#ifdef OUT_HAS_NEG
    template < class T, enable_if_t < _is_signed < T >, int > = 0 >
    inline void write(T x)
    {
        char buffer[numeric_limits < T >::digits10 + 1]; int digits = 0;
        if ( x >= 0 )  do buffer[digits++] =  ( x % 10 ) | 48, x /= 10; while ( x );
        else { pc(45); do buffer[digits++] = -( x % 10 ) | 48, x /= 10; while ( x ); }
        while ( digits ) pc(buffer[--digits]);
    }
    template < class T, enable_if_t < _is_unsigned < T >, int > = 0 >
#else
    template < class T, enable_if_t < _is_integer < T >, int > = 0 >
#endif
    inline void write(T x)
    {
        char buffer[numeric_limits < T >::digits10 + 1]; int digits = 0;
        do buffer[digits++] = ( x % 10 ) | 48, x /= 10; while ( x );
        while ( digits ) pc(buffer[--digits]);
    }
    template < int N > struct _tuple_io_helper
    {
        template < class ...T >
        static inline void _read(tuple < T... > &x)
        { _tuple_io_helper < N - 1 >::_read(x), read(get < N - 1 > (x)); }
        template < class ...T >
        static inline void _write(const tuple < T... > &x)
        { _tuple_io_helper < N - 1 >::_write(x), pc(32), write(get < N - 1 > (x)); }
    };
    template <> struct _tuple_io_helper < 1 >
    {
        template < class ...T >
        static inline void _read(tuple < T... > &x) { read(get < 0 > (x)); }
        template < class ...T >
        static inline void _write(const tuple < T... > &x) { write(get < 0 > (x)); }
    };
    template < class ...T >
    inline void read(tuple < T... > &x) { _tuple_io_helper < sizeof...(T) >::_read(x); }
    template < class ...T >
    inline void write(const tuple < T... > &x) { _tuple_io_helper < sizeof...(T) >::_write(x); }
    template < class T1, class T2 >
    inline void read(pair < T1, T2 > &x) { read(x.first), read(x.second); }
    template < class T1, class T2 >
    inline void write(const pair < T1, T2 > &x) { write(x.first), pc(32), write(x.second); }
    template < class T1, class ...T2 >
    inline void read(T1 &x, T2 &...y) { read(x), read(y...); }
    template < class ...T >
    inline void read_cstr(char *x, T *...y) { read_cstr(x), read_cstr(y...); }
    template < class T1, class ...T2 >
    inline void write(const T1 &x, const T2 &...y) { write(x), write(y...); }
    template < class ...T >
    inline void write_cstr(const char *x, const T *...y) { write_cstr(x), write_cstr(y...); }
    template < class T >
    inline void print(const T &x) { write(x); }
    inline void print_cstr(const char *x) { write_cstr(x); }
    template < class T1, class ...T2 >
    inline void print(const T1 &x, const T2 &...y) { print(x), pc(32), print(y...); }
    template < class ...T >
    inline void print_cstr(const char *x, const T *...y) { print_cstr(x), pc(32), print_cstr(y...); }
    inline void println() { pc(10); }
    inline void println_cstr() { pc(10); }
    template < class ...T >
    inline void println(const T &...x) { print(x...), pc(10); }
    template < class ...T >
    inline void println_cstr(const T *...x) { print_cstr(x...), pc(10); }
}
using namespace FastIO;
template <typename T>
inline void clear(T &x) {
    T y;
    swap(x, y);
}
const int N = 50005;
struct Node {
    ll x, y;
    int idx, idy, cid;
};
vector<Node> g, f;
int L;
int a[N];
inline bool calc(Node a, Node b, Node k) {
    return (b.y - a.y) * (k.x - a.x) >= (k.y - a.y) * (b.x - a.x);
}
inline vector<Node> solve(vector<Node> qaq) {
    sort(qaq.begin(), qaq.end(), [&](Node x, Node y) { return x.x != y.x ? x.x < y.x : x.y < y.y; });
    vector<Node> res;
    for (int i = 0; i < qaq.size(); i++) {
        if (i + 1 != qaq.size() && qaq[i].x == qaq[i + 1].x) continue;
        while (res.size() >= 2 && calc(res.end()[-2], qaq[i], res.back())) res.pop_back();
        res.push_back(qaq[i]);
    }
    return res;
}
int ans[N], pans[N], tans[N];
inline void work() {
    clear(f), clear(g);
    // read(L);
    cin >> L;
    __int128_t jia = 0, jib = 0;
    for (int i = 1; i <= L; i++) {
        clear(f);
        vector<Node> qaq;
        int n1;
        cin >> n1;
        for (int p = 1; p <= n1; p++) {
            long double pa, pb;
            cin >> pa >> pb;
            f.push_back({ll(pa * 100 + 1e-5), ll(pb * 100 + 1e-5), i, p});
        }
        f = solve(f);
        jia += f[0].x, jib += f[0].y;
        pans[i] = f[0].idy;
        int psiz = g.size();
        for (int j = 1; j < f.size(); j++) g.push_back({f[j].x - f[j - 1].x,  f[j].y - f[j - 1].y, f[j].idx, f[j].idy, j}), qaq.push_back({f[j].x - f[j - 1].x,  f[j].y - f[j - 1].y, f[j].idx, f[j].idy, j});
        for (int j = 1; j < qaq.size(); j++) {
            assert(qaq[j].y * qaq[j - 1].x <= qaq[j - 1].y * qaq[j].x);
        }
        // assert(is_sorted(g.begin() + psiz, g.end(), [&](Node a, Node b) { return a.y / a.x > b.y / b.x; }));
    }
    sort(g.begin(), g.end(), [&](Node a, Node b) { return a.idx == b.idx ? a.cid < b.cid : a.y * b.x > b.y * a.x; });
    int q;
    // cerr << "find pans:" << pans[1] << ' ' << pans[2] << endl;
    // for (auto [px, py, fwa, fwb] : g) cerr << "find youmo:" << px << ' ' << py << ' ' << fwa << ' ' << fwb << endl;
    cin >> q;
    while (q--) {
        long double XXa, XXb;
        cin >> XXa >> XXb;
        __int128_t Xa = XXa * 100 + 1e-5, Xb = XXb * 100 + 1e-5;
        __int128_t valans = 0;
        __int128_t pjia = jia, pjib = jib;
        chkmax(valans, (Xa + pjia) * (Xb + pjib));
        for (auto [px, py, fwa, fwb, qid] : g) pjia += px, pjib += py, chkmax(valans, (Xa + pjia) * (Xb + pjib));
        pjia = jia, pjib = jib;
        memcpy(ans, pans, sizeof(ans[0]) * (L + 2));
        memcpy(tans, pans, sizeof(ans[0]) * (L + 2));
        for (auto [px, py, fwa, fwb, qid] : g) {
            // cerr << "find update:" << fwa << ' ' << fwb << endl;
            pjia += px, pjib += py;
            ans[fwa] = fwb;
            if ((Xa + pjia) * (Xb + pjib) == valans) {
                memcpy(tans, ans, sizeof(ans[0]) * (L + 2));
                break;
            }
        }
        // cerr << "find ans:" << valans << endl;
        for (int i =1; i <= L; i++) cout << tans[i] << ' ';
        cout << endl;
    }
}
int main() {
    ios::sync_with_stdio(0), cin.tie(0);
    int T;
    cin >> T >> T;
    while (T--) work();
    return 0;
}

詳細信息

Subtask #1:

score: 15
Accepted

Test #1:

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

input:

1 100
5
3
98 71 28 7 62 13
3
29 23 65 70 34 95
3
59 41 64 43 92 59
3
73 75 99 96 43 2
3
14 24 5 7 54 13
10
8.06 47.73
183.28 351.90
83.70 90.40
34.00 127.83
216.88 312.31
182.09 349.61
266.90 320.28
84.18 420.91
33.26 145.00
118.07 354.22
5
3
25 63 11 75 63 31
3
94 53 38 89 46 23
3
49 99 12 80 52 4
...

output:

1 2 3 2 3 
1 2 3 2 3 
1 2 3 2 3 
1 2 3 2 3 
1 2 3 2 3 
1 2 3 2 3 
1 2 3 2 3 
1 2 3 2 3 
1 2 3 2 3 
1 2 3 2 3 
3 1 1 2 1 
3 1 1 2 1 
3 1 1 2 1 
3 1 1 2 1 
3 1 1 2 1 
3 1 1 2 1 
3 1 1 2 1 
3 1 1 2 1 
3 1 1 2 1 
3 1 1 2 1 
1 3 1 1 2 
1 3 1 1 2 
1 3 1 1 2 
1 2 1 1 2 
1 2 1 1 2 
1 2 1 1 2 
1 3 1 1 2 
1 3...

result:

ok OK, Accepted

Test #2:

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

input:

1 100
5
3
100 44 62 34 64 47
3
9 52 94 73 70 100
3
8 10 87 17 53 61
3
89 88 5 36 2 35
3
76 13 90 71 45 89
10
33.88 69.11
120.74 410.51
119.96 340.70
82.73 416.98
27.98 30.22
69.37 110.99
27.26 153.77
36.29 164.04
56.99 241.65
158.23 272.16
5
3
87 41 60 98 33 50
3
7 83 3 43 78 6
3
88 42 98 97 72 91
3...

output:

1 3 3 1 2 
1 2 3 1 2 
1 2 3 1 2 
1 2 2 1 2 
1 3 3 1 2 
1 3 3 1 2 
1 2 3 1 2 
1 2 3 1 2 
1 2 3 1 2 
1 3 3 1 2 
2 3 2 3 1 
2 3 2 3 1 
2 3 2 3 1 
2 3 2 3 1 
2 3 2 3 1 
2 1 2 3 1 
2 3 2 3 1 
2 1 2 3 1 
2 3 2 3 1 
2 3 2 3 1 
2 3 3 3 3 
2 3 3 3 3 
2 3 3 3 3 
2 3 3 3 3 
2 3 3 3 3 
2 3 3 3 3 
2 3 3 3 3 
2 3...

result:

ok OK, Accepted

Subtask #2:

score: 20
Accepted

Test #3:

score: 20
Accepted
time: 8ms
memory: 3912kb

input:

2 100
27
9
58 21 76 52 99 40 22 25 26 38 25 65 80 47 59 83 12 7
10
87 40 54 90 65 88 86 75 92 22 5 70 53 88 72 34 25 55 7 66
10
8 69 28 19 80 41 17 15 40 82 9 57 77 43 79 63 24 39 62 30
10
38 41 5 45 55 80 93 63 96 46 98 50 31 48 49 49 77 63 46 54
10
99 11 33 21 69 25 9 17 93 30 87 16 22 93 97 36 84...

output:

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

result:

ok OK, Accepted

Test #4:

score: 20
Accepted
time: 8ms
memory: 4116kb

input:

2 100
20
9
87 13 97 57 97 11 92 28 57 82 84 72 56 15 10 21 25 24
9
58 100 94 59 25 87 100 26 47 32 58 46 16 25 65 76 54 65
9
42 3 17 26 44 22 20 83 11 93 7 51 87 7 85 5 96 23
8
26 67 18 14 24 74 8 90 9 90 38 75 33 7 7 40
8
22 25 32 36 95 90 27 2 25 31 82 4 98 77 100 75
8
7 16 94 93 85 100 77 41 90 7...

output:

2 2 9 6 3 2 3 8 1 5 9 3 3 8 3 9 8 5 1 8 
6 1 9 6 3 2 3 8 1 5 9 3 3 8 3 9 7 5 9 8 
2 2 9 6 3 2 3 8 1 5 9 3 3 8 3 9 8 5 9 8 
6 1 9 6 3 2 3 8 1 5 9 3 3 8 3 9 7 5 9 8 
2 2 9 6 3 2 3 8 1 5 9 3 3 8 3 9 8 5 9 8 
2 2 9 6 3 2 3 8 1 5 9 3 3 8 3 9 8 5 9 8 
2 2 9 6 3 2 3 8 1 5 9 3 3 8 3 9 8 5 9 8 
6 1 9 6 3 2 3...

result:

ok OK, Accepted

Test #5:

score: 20
Accepted
time: 8ms
memory: 3772kb

input:

2 100
14
10
60 79 33 78 95 31 45 12 68 96 30 21 66 62 80 43 44 100 20 16
8
25 11 64 47 10 5 39 51 28 12 67 81 86 85 98 22
10
91 99 87 11 61 42 57 87 100 11 4 54 7 50 25 83 16 40 52 38
9
89 100 19 88 4 75 10 15 85 10 98 9 80 38 17 81 48 57
10
62 72 40 10 31 64 79 45 63 10 7 15 78 93 6 69 97 66 71 87
...

output:

5 7 1 1 9 2 3 2 5 5 6 7 1 10 
5 7 1 1 7 2 3 2 5 5 6 7 1 10 
3 7 1 1 9 2 3 2 5 5 6 7 1 10 
5 7 1 1 9 2 3 2 5 5 6 7 1 10 
3 7 1 1 9 2 3 2 5 5 6 7 1 10 
5 7 1 1 9 2 3 2 5 5 6 7 1 10 
3 7 1 1 9 2 3 2 5 5 6 7 1 10 
5 7 1 1 9 2 3 2 5 5 6 7 1 10 
5 7 1 1 9 2 3 2 5 5 6 7 1 10 
5 7 1 1 9 2 3 2 5 5 6 7 1 10 
...

result:

ok OK, Accepted

Subtask #3:

score: 15
Accepted

Test #6:

score: 15
Accepted
time: 140ms
memory: 3996kb

input:

3 100
496
9
62 33 67 95 25 42 68 17 2 18 65 76 39 78 27 37 55 75
9
97 77 28 91 37 55 83 37 34 82 12 29 58 78 28 6 81 35
8
17 22 2 52 92 14 4 59 82 7 23 37 75 67 39 87
8
62 70 17 5 7 95 84 73 36 35 17 85 84 61 89 69
9
1 80 10 60 37 75 51 64 42 24 89 3 74 56 82 89 87 66
10
79 23 29 19 38 15 14 33 85 1...

output:

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

result:

ok OK, Accepted

Test #7:

score: 15
Accepted
time: 137ms
memory: 4156kb

input:

3 100
495
9
58 39 26 74 43 8 38 40 92 13 39 22 74 72 61 90 96 58
10
75 61 67 30 19 15 10 90 71 21 91 59 42 65 54 6 7 17 95 77
8
78 39 80 44 3 49 56 11 73 75 48 13 70 53 86 85
8
62 50 49 16 35 42 12 2 85 45 38 70 9 7 20 13
9
16 77 12 8 14 83 7 39 89 42 23 74 16 45 4 27 43 100
8
50 67 7 91 60 55 69 51...

output:

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

result:

ok OK, Accepted

Test #8:

score: 15
Accepted
time: 133ms
memory: 3880kb

input:

3 100
482
9
55 66 2 65 79 73 52 98 21 48 64 88 58 25 47 30 13 42
9
86 5 13 53 29 33 98 38 15 79 67 89 16 85 2 66 75 6
10
40 32 76 77 33 64 91 13 50 96 79 36 44 51 17 82 37 13 20 99
10
87 17 38 21 63 23 66 63 33 91 40 90 83 70 73 7 11 38 31 57
8
75 98 42 98 96 28 41 18 80 40 95 24 95 24 94 38
10
54 9...

output:

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

result:

ok OK, Accepted

Test #9:

score: 15
Accepted
time: 147ms
memory: 4032kb

input:

3 100
492
8
8 78 31 85 67 47 68 5 48 13 50 51 30 63 50 40
9
85 7 55 24 8 62 31 24 25 30 72 41 24 51 13 48 6 46
10
52 46 51 58 5 75 65 72 91 11 87 46 89 60 8 100 50 86 8 90
9
82 37 38 80 72 69 45 14 49 49 67 92 68 56 6 18 1 88
8
38 66 84 1 30 96 40 22 85 83 48 36 48 81 80 34
10
93 31 17 53 26 48 53 8...

output:

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

result:

ok OK, Accepted

Test #10:

score: 15
Accepted
time: 141ms
memory: 4032kb

input:

3 100
486
10
80 39 1 81 76 76 5 65 35 58 61 87 25 45 91 83 79 100 55 92
8
4 29 59 65 76 77 37 3 58 85 63 75 85 67 12 72
9
31 76 66 17 38 45 64 11 94 79 33 1 8 72 59 29 15 56
8
28 28 4 62 80 29 2 40 10 34 60 42 9 36 100 76
10
44 3 25 6 43 53 97 45 71 90 69 51 4 23 70 73 18 100 9 56
9
50 70 32 36 37 8...

output:

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

result:

ok OK, Accepted

Test #11:

score: 15
Accepted
time: 136ms
memory: 3884kb

input:

3 100
494
8
65 81 55 52 83 29 32 44 61 70 74 33 35 35 28 4
8
21 69 26 6 82 43 20 32 88 54 67 17 15 48 98 54
9
56 16 48 53 47 87 69 79 35 43 67 43 31 82 52 5 67 89
10
86 66 82 73 89 100 48 34 89 54 61 41 91 94 3 75 8 73 10 56
9
7 81 3 37 24 47 82 49 95 15 8 37 46 57 78 25 33 78
9
74 96 40 90 59 60 17...

output:

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

result:

ok OK, Accepted

Subtask #4:

score: 15
Accepted

Test #12:

score: 15
Accepted
time: 161ms
memory: 4072kb

input:

4 100
450
10
30.37 69.63 50.77 49.23 94.68 5.32 36.02 63.98 30.92 69.08 60.25 39.75 94.63 5.37 61.38 38.62 91.27 8.73 28.94 71.06
8
74.79 25.21 8.63 91.37 49.25 50.75 27.02 72.98 72.03 27.97 52.44 47.56 41.20 58.80 44.26 55.74
9
58.02 41.98 35.82 64.18 99.61 0.39 59.26 40.74 47.09 52.91 87.65 12.35 ...

output:

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

result:

ok OK, Accepted

Test #13:

score: 15
Accepted
time: 175ms
memory: 4036kb

input:

4 99
63
8
56.07 43.93 7.47 92.53 75.93 24.07 9.01 90.99 18.30 81.70 96.34 3.66 90.45 9.55 53.20 46.80
10
1.07 98.93 72.63 27.37 17.95 82.05 45.24 54.76 95.30 4.70 92.15 7.85 5.08 94.92 87.38 12.62 2.72 97.28 19.35 80.65
8
61.30 38.70 69.88 30.12 23.82 76.18 53.45 46.55 5.66 94.34 3.79 96.21 49.96 50...

output:

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

result:

ok OK, Accepted

Test #14:

score: 15
Accepted
time: 169ms
memory: 4268kb

input:

4 100
1251
10
80.32 19.68 57.28 42.72 44.25 55.75 35.27 64.73 73.44 26.56 14.02 85.98 78.54 21.46 74.82 25.18 0.16 99.84 22.85 77.15
10
1.76 98.24 8.12 91.88 79.71 20.29 26.44 73.56 87.26 12.74 65.05 34.95 28.67 71.33 88.16 11.84 20.45 79.55 69.32 30.68
10
87.92 12.08 44.59 55.41 16.06 83.94 7.57 92...

output:

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

result:

ok OK, Accepted

Subtask #5:

score: 35
Accepted

Test #15:

score: 35
Accepted
time: 200ms
memory: 5036kb

input:

5 100
400
9
1.57 81.69 17.89 66.70 65.51 20.96 14.19 70.10 73.04 13.58 25.01 60.09 57.73 28.55 18.21 66.41 41.57 44.34
8
42.15 15.21 45.93 11.16 27.62 30.65 39.90 17.60 9.87 47.93 51.17 5.44 14.72 43.43 42.11 15.26
9
15.72 52.00 32.33 36.33 7.60 59.51 39.83 28.78 58.75 9.42 30.01 38.51 24.14 44.06 0...

output:

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

result:

ok OK, Accepted

Test #16:

score: 35
Accepted
time: 195ms
memory: 4216kb

input:

5 100
13
10
64.64 5.55 42.82 28.29 14.99 55.69 35.69 35.65 14.18 56.47 55.69 15.01 45.77 25.25 28.49 42.79 55.67 15.04 3.92 66.10
10
30.58 59.22 59.97 28.81 17.77 72.29 23.89 66.09 21.17 68.84 73.61 14.14 47.19 42.19 53.90 35.16 77.27 10.21 1.42 88.79
9
48.23 41.29 26.36 61.91 36.01 52.86 70.58 18.4...

output:

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

result:

ok OK, Accepted

Test #17:

score: 35
Accepted
time: 200ms
memory: 4352kb

input:

5 100
561
8
14.10 35.37 25.64 24.62 16.17 33.48 36.09 13.51 40.27 8.93 18.24 31.57 21.59 28.42 22.88 27.21
10
29.66 67.04 72.67 22.30 48.76 47.44 46.75 49.50 23.04 73.33 84.53 9.28 67.16 28.36 33.33 63.27 7.43 88.19 65.14 30.57
8
30.95 32.85 55.25 7.95 58.34 4.68 55.00 8.20 12.56 51.23 57.41 5.68 19...

output:

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

result:

ok OK, Accepted

Test #18:

score: 35
Accepted
time: 200ms
memory: 4572kb

input:

5 100
178
10
72.69 18.57 77.39 14.03 47.32 42.53 53.55 36.68 14.53 72.85 36.79 52.41 66.06 24.85 83.00 8.24 61.89 28.81 57.51 32.97
10
43.49 30.26 56.68 16.40 42.07 31.66 48.42 25.08 10.86 62.03 39.79 33.92 27.97 45.56 11.37 61.55 17.61 55.76 65.00 7.67
9
39.70 27.12 60.54 4.84 38.94 27.88 53.73 12....

output:

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

result:

ok OK, Accepted

Test #19:

score: 35
Accepted
time: 198ms
memory: 4256kb

input:

5 100
699
9
34.44 58.43 9.94 80.87 48.34 45.16 37.38 55.69 55.32 38.39 71.64 22.50 27.94 64.49 81.31 13.09 41.56 51.75
9
3.07 78.96 60.12 23.42 55.75 28.14 17.84 64.99 68.35 14.55 12.49 70.05 25.03 58.20 47.67 36.18 43.75 40.04
8
32.03 17.39 20.36 29.57 13.93 35.96 34.24 14.97 17.94 32.05 16.97 32.9...

output:

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

result:

ok OK, Accepted

Test #20:

score: 35
Accepted
time: 199ms
memory: 4436kb

input:

5 100
914
9
77.12 4.74 41.06 40.51 81.38 0.44 8.27 71.78 61.04 20.90 58.32 23.56 25.70 55.33 38.30 43.17 49.16 32.56
10
18.34 79.32 77.94 19.17 12.72 84.75 60.48 37.29 55.74 42.21 81.84 15.00 34.77 63.45 33.94 64.25 2.76 94.03 6.47 90.57
10
62.03 20.39 71.00 10.82 66.94 15.23 21.55 60.88 34.23 49.24...

output:

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

result:

ok OK, Accepted

Test #21:

score: 35
Accepted
time: 199ms
memory: 5096kb

input:

5 100
166
8
8.95 69.41 66.83 12.81 57.14 23.44 55.01 25.65 74.64 4.26 18.10 60.76 23.12 56.02 37.61 42.25
8
69.86 8.52 31.09 50.78 47.75 32.83 20.57 61.87 35.21 46.45 19.66 62.80 19.07 63.33 5.34 75.84
8
79.74 8.07 10.89 75.89 34.76 53.78 59.95 28.81 32.34 56.03 77.59 10.33 73.23 14.89 10.64 76.13
1...

output:

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

result:

ok OK, Accepted

Test #22:

score: 35
Accepted
time: 199ms
memory: 4532kb

input:

5 100
55
8
30.56 46.73 56.36 22.03 7.84 68.33 53.32 24.94 3.52 72.43 70.93 6.62 50.26 27.86 57.97 20.46
8
1.08 88.35 16.83 73.58 33.20 57.11 54.17 34.79 76.85 10.64 4.58 85.06 68.33 19.71 19.79 70.70
10
69.28 20.98 27.10 63.48 12.29 77.55 22.96 67.54 40.05 50.60 63.49 27.07 47.26 43.42 67.99 22.34 6...

output:

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

result:

ok OK, Accepted

Test #23:

score: 35
Accepted
time: 195ms
memory: 4580kb

input:

5 100
212
10
51.66 32.71 41.03 43.54 50.03 34.37 14.51 68.68 55.07 29.24 59.97 24.16 69.93 13.80 22.18 61.45 38.84 45.75 13.99 69.18
8
62.39 3.80 30.01 36.18 26.69 39.32 16.41 49.06 53.79 12.81 55.59 10.95 1.67 62.59 20.01 45.65
10
41.94 35.64 63.39 13.42 66.53 10.08 9.69 67.72 12.37 65.11 36.49 41....

output:

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

result:

ok OK, Accepted

Test #24:

score: 35
Accepted
time: 196ms
memory: 4480kb

input:

5 99
470
10
88.64 13.44 34.08 70.16 23.26 81.05 23.08 81.22 48.38 55.77 77.72 25.02 79.64 22.98 63.08 40.44 40.48 63.72 14.70 89.49
8
12.61 57.87 15.16 55.51 53.23 15.90 56.02 12.96 32.52 37.76 42.30 27.43 31.48 38.83 61.97 6.46
9
39.39 45.21 35.44 49.33 0.50 84.35 26.33 58.81 17.51 67.70 27.34 57.7...

output:

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

result:

ok OK, Accepted