QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#510562#8646. Card CollectionMax_s_xaM100 ✓1537ms117080kbC++1415.9kb2024-08-09 09:18:232024-08-09 09:18:24

Judging History

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

  • [2024-08-09 09:18:24]
  • 评测
  • 测评结果:100
  • 用时:1537ms
  • 内存:117080kb
  • [2024-08-09 09:18:23]
  • 提交

answer

#include <iostream>
#include <algorithm>
#include <cstring>

typedef long long ll;
typedef double lf;

// #define DEBUG 1
struct IO
{
    #define MAXSIZE (1 << 20)
    #define isdigit(x) (x >= '0' && x <= '9')
    char buf[MAXSIZE], *p1, *p2;
    char pbuf[MAXSIZE], *pp;
    #if DEBUG
    #else
    IO() : p1(buf), p2(buf), pp(pbuf) {}
    ~IO() {fwrite(pbuf, 1, pp - pbuf, stdout);}
    #endif
    #define gc() (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, MAXSIZE, stdin), p1 == p2) ? ' ' : *p1++)
    #define blank(x) (x == ' ' || x == '\n' || x == '\r' || x == '\t')

    template <typename T>
    void Read(T &x)
    {
        #if DEBUG
        std::cin >> x;
        #else
        bool sign = 0; char ch = gc(); x = 0;
        for (; !isdigit(ch); ch = gc())
            if (ch == '-') sign = 1;
        for (; isdigit(ch); ch = gc()) x = x * 10 + (ch ^ 48);
        if (sign) x = -x;
        #endif
    }
    void Read(char *s)
    {
        #if DEBUG
        std::cin >> s;
        #else
        char ch = gc();
        for (; blank(ch); ch = gc());
        for (; !blank(ch); ch = gc()) *s++ = ch;
        *s = 0;
        #endif
    }
    void Read(char &c) {for (c = gc(); blank(c); c = gc());}

    void Push(const char &c)
    {
        #if DEBUG
        putchar(c);
        #else
        if (pp - pbuf == MAXSIZE) fwrite(pbuf, 1, MAXSIZE, stdout), pp = pbuf;
        *pp++ = c;
        #endif
    }
    template <typename T>
    void Write(T x)
    {
        if (x < 0) x = -x, Push('-');
        static T sta[35];
        int top = 0;
        do sta[top++] = x % 10, x /= 10; while (x);
        while (top) Push(sta[--top] ^ 48);
    }
    template <typename T>
    void Write(T x, char lst) {Write(x), Push(lst);}
} IO;
#define Read(x) IO.Read(x)
#define Write(x, y) IO.Write(x, y)
#define Put(x) IO.Push(x)

using namespace std;

const int MAXN = 2e5 + 10;

int n, m;
struct point
{
    int x, y;
}a[MAXN];
int m1, m2, b1[MAXN], b2[MAXN];
int X[2][MAXN], Y[2][MAXN];

struct qry
{
    int x, y, lp[2], rp[2], id;
    int d0[2], d1[2];
    int pcnt[2], scnt[2];
    int pre[2], suf[2];
    int mid[2][2];
}qt[MAXN];

int lg[MAXN];
struct RMQ
{
    int f[MAXN][19], g[MAXN][19];
    inline void Build(int *a)
    {
        for (int i = 1; i <= n; i++) f[i][0] = g[i][0] = a[i];
        for (int j = 1; j < lg[n]; j++)
            for (int i = 1; i + (1 << j) - 1 <= n; i++)
                f[i][j] = min(f[i][j - 1], f[i + (1 << j - 1)][j - 1]), g[i][j] = max(g[i][j - 1], g[i + (1 << j - 1)][j - 1]);
    }
    inline int qmin(int l, int r)
    {
        if (l > r) return 2e9;
        int s = lg[r - l + 1] - 1;
        return min(f[l][s], f[r - (1 << s) + 1][s]);
    }
    inline int qmax(int l, int r)
    {
        if (l > r) return -2e9;
        int s = lg[r - l + 1] - 1;
        return max(g[l][s], g[r - (1 << s) + 1][s]);
    }
}rx, ry;

int idx[MAXN], ai[MAXN];

int bit1[MAXN], bit2[MAXN];
inline void Add(int x, int k) { for (; x <= m2; x += (x & -x)) bit1[x] = min(bit1[x], k), bit2[x] = max(bit2[x], k); }
inline pair <int, int> Ask(int x) { int res1 = 2e9, res2 = -2e9; for (; x; x -= (x & -x)) res1 = min(res1, bit1[x]), res2 = max(res2, bit2[x]); return {res1, res2}; }

struct node
{
    int t, id, f, _;
    bool operator < (const node &u) const { return t < u.t; }
}h[MAXN << 2];
int tot, hr[MAXN << 2];

struct subqry
{
    int x, y, id;
}st[MAXN << 3];
int top;

int bit[MAXN];
inline void Upd(int x, int k) { for (; x <= m2; x += (x & -x)) bit[x] += k; }
inline int Qry(int x) { int res = 0; for (; x; x -= (x & -x)) res += bit[x]; return res; }

inline void Solve1(int l, int r, int ql, int qr)
{
    if (l > r || ql > qr) return;
    if (l == r)
    {
        for (int i = ql; i <= qr; i++) hr[i] += (a[l].x >= qt[h[i].id].x) && (a[l].y <= qt[h[i].id].y);
        return;
    }
    int mid = l + r >> 1, qmid = ql - 1;
    while (qmid < qr && h[qmid + 1].t <= mid) qmid++;
    top = 0;
    for (int i = l; i <= mid; i++) st[++top] = subqry{a[i].x, a[i].y, 0};
    for (int i = qmid + 1; i <= qr; i++) st[++top] = subqry{qt[h[i].id].x, qt[h[i].id].y, i};
    sort(st + 1, st + top + 1, [&](const subqry &u, const subqry &v) { return u.x == v.x ? (u.y == v.y ? u.id < v.id : u.y < v.y) : u.x > v.x; });
    for (int i = 1; i <= top; i++)
        if (st[i].id == 0) Upd(st[i].y, 1);
        else hr[st[i].id] += Qry(st[i].y);
    for (int i = 1; i <= top; i++)
        if (st[i].id == 0) Upd(st[i].y, -1);
    Solve1(l, mid, ql, qmid), Solve1(mid + 1, r, qmid + 1, qr);
}
inline void Solve2(int l, int r, int ql, int qr)
{
    if (l > r || ql > qr) return;
    if (l == r)
    {
        for (int i = ql; i <= qr; i++) hr[i] += (a[l].x <= qt[h[i].id].x) && (a[l].y >= qt[h[i].id].y);
        return;
    }
    int mid = l + r >> 1, qmid = ql - 1;
    while (qmid < qr && h[qmid + 1].t <= mid) qmid++;
    top = 0;
    for (int i = l; i <= mid; i++) st[++top] = subqry{a[i].x, a[i].y, 0};
    for (int i = qmid + 1; i <= qr; i++) st[++top] = subqry{qt[h[i].id].x, qt[h[i].id].y, i};
    sort(st + 1, st + top + 1, [&](const subqry &u, const subqry &v) { return u.x == v.x ? (u.y == v.y ? u.id < v.id : u.y > v.y) : u.x < v.x; });
    for (int i = 1; i <= top; i++)
        if (st[i].id == 0) Upd(m2 - st[i].y + 1, 1);
        else hr[st[i].id] += Qry(m2 - st[i].y + 1);
    for (int i = 1; i <= top; i++)
        if (st[i].id == 0) Upd(m2 - st[i].y + 1, -1);
    Solve2(l, mid, ql, qmid), Solve2(mid + 1, r, qmid + 1, qr);
}

int s, t, pre[9], suf[9];
int cx(int x) { return (x > s ? 2 : (x == s ? 1 : 0)); }
int cy(int y) { return (y > t ? 2 : (y == t ? 1 : 0)); }
int tr(int i) { return cx(a[i].x) * 3 + cy(a[i].y); }

int main()
{
    // freopen("A.in", "r", stdin);
    // freopen("A.out", "w", stdout);
    #if DEBUG
    #else
    ios::sync_with_stdio(0), cin.tie(0);
    #endif
    Read(n), Read(m);
    for (int i = 1; i <= n; i++) Read(a[i].x), Read(a[i].y), b1[++m1] = a[i].x, b2[++m2] = a[i].y;
    sort(b1 + 1, b1 + m1 + 1), m1 = unique(b1 + 1, b1 + m1 + 1) - b1 - 1;
    sort(b2 + 1, b2 + m2 + 1), m2 = unique(b2 + 1, b2 + m2 + 1) - b2 - 1;
    b1[m1 + 1] = b2[m2 + 1] = -1;
    for (int i = 1; i <= n; i++)
        a[i].x = lower_bound(b1 + 1, b1 + m1 + 1, a[i].x) - b1, 
        a[i].y = lower_bound(b2 + 1, b2 + m2 + 1, a[i].y) - b2;
    for (int i = 1, j = 1; i <= m; i++)
    {
        Read(qt[i].x), Read(qt[i].y), qt[i].id = j++;
        int xx = lower_bound(b1 + 1, b1 + m1 + 1, qt[i].x) - b1;
        int yy = lower_bound(b2 + 1, b2 + m2 + 1, qt[i].y) - b2;
        if (qt[i].x != b1[xx] || qt[i].y != b2[yy]) { i--, m--; continue; }
        qt[i].x = xx, qt[i].y = yy;
    }
    for (int i = 1; i <= n; i++) X[1][a[i].x] = i, Y[1][a[i].y] = i;
    for (int i = n; i >= 1; i--) X[0][a[i].x] = i, Y[0][a[i].y] = i;
    for (int i = 1; i <= m; i++)
    {
        qt[i].lp[0] = X[0][qt[i].x], qt[i].rp[0] = Y[1][qt[i].y];
        qt[i].lp[1] = Y[0][qt[i].y], qt[i].rp[1] = X[1][qt[i].x];
        if (!qt[i].lp[0]) qt[i].lp[0] = n + 1;
        if (!qt[i].lp[1]) qt[i].lp[1] = n + 1;
    }

    // for (int i = 1; i <= n; i++) cout << a[i].x << ' ' << a[i].y << '\n';
    // cout << '\n';
    // for (int i = 1; i <= m; i++) cout << qt[i].x << ' ' << qt[i].y << '\n';
    // cout << '\n';

    // for (int i = 1; i <= m; i++)
    //     cout << qt[i].lp[0] << ' ' << qt[i].rp[0] << ' ' << qt[i].lp[1] << ' ' << qt[i].rp[1] << '\n'; cout << "\n";

    for (int i = 1; i <= n; i++) b1[i] = a[i].x, b2[i] = a[i].y, lg[i] = lg[i >> 1] + 1;
    rx.Build(b1), ry.Build(b2);
    
    for (int i = 1; i <= m; i++)
        for (int _ = 0; _ < 2; _++)
        {
            int xx = qt[i].x, yy = qt[i].y;
            int l = 2, r = qt[i].lp[_] - 1, mid, cpos = r;
            while (l <= r)
            {
                mid = l + r >> 1;
                if ((xx > a[1].x ? rx.qmax(1, mid) < xx : (xx < a[1].x ? rx.qmin(1, mid) > xx : rx.qmin(1, mid) == rx.qmax(1, mid))) &&
                    (yy > a[1].y ? ry.qmax(1, mid) < yy : (yy < a[1].y ? ry.qmin(1, mid) > yy : ry.qmin(1, mid) == ry.qmax(1, mid))))
                    l = mid + 1;
                else r = mid - 1;
            }
            qt[i].d0[_] = l;
            if (cpos == 0) qt[i].pcnt[_] = 0;
            else if ((rx.qmax(1, cpos) < xx || rx.qmin(1, cpos) > xx || rx.qmax(1, cpos) == rx.qmin(1, cpos)) &&
                (ry.qmax(1, cpos) < yy || ry.qmin(1, cpos) > yy || ry.qmax(1, cpos) == ry.qmin(1, cpos)))
                    qt[i].pcnt[_] = 1;
            else qt[i].pcnt[_] = 2;
        }
    for (int i = 1; i <= m; i++)
        for (int _ = 0; _ < 2; _++)
        {
            int xx = qt[i].x, yy = qt[i].y;
            int l = qt[i].rp[_] + 1, r = n - 1, mid, cpos = l;
            while (l <= r)
            {
                mid = l + r >> 1;
                if ((xx > a[n].x ? rx.qmax(mid, n) < xx : (xx < a[n].x ? rx.qmin(mid, n) > xx : rx.qmin(mid, n) == rx.qmax(mid, n))) && 
                    (yy > a[n].y ? ry.qmax(mid, n) < yy : (yy < a[n].y ? ry.qmin(mid, n) > yy : ry.qmin(mid, n) == ry.qmax(mid, n))))
                    r = mid - 1;
                else l = mid + 1;
            }
            qt[i].d1[_] = r;
            if (cpos == n + 1) qt[i].scnt[_] = 0;
            else if ((rx.qmax(cpos, n) < xx || rx.qmin(cpos, n) > xx || rx.qmax(cpos, n) == rx.qmin(cpos, n)) &&
                (ry.qmax(cpos, n) < yy || ry.qmin(cpos, n) > yy || ry.qmax(cpos, n) == ry.qmin(cpos, n)))
                    qt[i].scnt[_] = 1;
            else qt[i].scnt[_] = 2;
        }

    // for (int i = 1; i <= m; i++)
    //     cout << qt[i].d0[0] << ' ' << qt[i].d1[0] << ' ' << qt[i].d0[1] << ' ' << qt[i].d1[1] << '\n'; cout << '\n';
    // cout << "cnt\n";
    // for (int i = 1; i <= m; i++)
    //     cout << qt[i].pcnt[0] << ' ' << qt[i].pcnt[1] << ' ' << qt[i].scnt[0] << ' ' << qt[i].scnt[1] << "\n";

    for (int i = 0; i <= m2; i++) bit1[i] = 2e9, bit2[i] = -2e9;
    for (int i = 1; i <= m; i++) idx[i] = i;
    for (int i = 1; i <= n; i++) ai[i] = i;
    sort(idx + 1, idx + m + 1, [&](int x, int y) { return qt[x].x < qt[y].x; });
    sort(ai + 1, ai + n + 1, [&](int x, int y) { return a[x].x < a[y].x; });
    for (int i = 1, j = 1; i <= m; i++)
    {
        while (j <= n && a[ai[j]].x < qt[idx[i]].x) Add(m2 - a[ai[j]].y + 1, ai[j]), j++;
        auto cur = Ask(m2 - qt[idx[i]].y);
        qt[idx[i]].pre[0] = cur.first, qt[idx[i]].suf[0] = cur.second;
    }
    for (int i = 0; i <= m2; i++) bit1[i] = 2e9, bit2[i] = -2e9;
    for (int i = m, j = n; i >= 1; i--)
    {
        while (j >= 1 && a[ai[j]].x > qt[idx[i]].x) Add(a[ai[j]].y, ai[j]), j--;
        auto cur = Ask(qt[idx[i]].y - 1);
        qt[idx[i]].pre[1] = cur.first, qt[idx[i]].suf[1] = cur.second;
    }

    for (int i = 1; i <= m; i++)
        for (int _ = 0; _ < 2; _++)
            if (qt[i].lp[_] + 1 < qt[i].rp[_])
                h[++tot] = node{qt[i].lp[_], i, -1, _}, h[++tot] = node{qt[i].rp[_] - 1, i, 1, _};
    sort(h + 1, h + tot + 1);
    Solve1(1, n, 1, tot);
    // for (int i = 1; i <= tot; i++)
    // {
    //     cout << h[i].t << ' ' << h[i].id << ' ' << h[i]._ << ' ' << h[i].f << ' ' << hr[i] << '\n';
    // }
    for (int i = 1; i <= tot; i++) qt[h[i].id].mid[h[i]._][0] += h[i].f * hr[i], hr[i] = 0;
    Solve2(1, n, 1, tot);
    for (int i = 1; i <= tot; i++) qt[h[i].id].mid[h[i]._][1] += h[i].f * hr[i], hr[i] = 0;

    // for (int i = 1; i <= m; i++, cout << '\n')
    //     for (int _ = 0; _ < 2; _++)
    //         cout << qt[i].mid[_][0] << ' ' << qt[i].mid[_][1] << ' '; cout << "\n";

    // for (int i = 1; i <= m; i++) cout << qt[i].pre[0] << ' ' << qt[i].pre[1] << ' ' << qt[i].suf[0] << ' ' << qt[i].suf[1] << "\n";

    for (int k = 1; k <= m; k++)
    {
        s = qt[k].x, t = qt[k].y;
        bool flag = 0;
        int lp = qt[k].lp[0], rp = qt[k].rp[0];
        if (lp <= rp)
        {
            memset(pre, 0, sizeof(pre)), memset(suf, 0, sizeof(suf));
            int d0 = qt[k].d0[0], d1 = qt[k].d1[0], c0 = qt[k].pcnt[0], c1 = qt[k].scnt[0];
            bool a0[3] = {0}, a1[3] = {0};

            if (qt[k].pre[0] < lp) pre[2] = qt[k].pre[0];
            if (qt[k].pre[1] < lp) pre[6] = qt[k].pre[1];
            if (qt[k].suf[0] > rp) suf[2] = qt[k].suf[0];
            if (qt[k].suf[1] > rp) suf[6] = qt[k].suf[1];

            if (lp == rp) { flag |= (c0 != 1 || (tr(1) != 2 && tr(1) != 6)) && (c1 != 1 || (tr(n) != 2 && tr(n) != 6)); goto NXT; }

            if (cy(a[lp].y) == 1)
            {
                if (c0 != 1 || (tr(1) != 2 && tr(1) != 6)) { flag = 1; goto NXT; }
                a0[3 - tr(1) / 2] = 1;
            }
            else
            {
                a0[cy(a[lp].y)] = c0 != 1 || !pre[cy(a[lp].y) * 2 + 2];
                a0[2 - cy(a[lp].y)] = pre[cy(a[lp].y) * 2 + 2] && (pre[cy(a[lp].y) * 2 + 2] != d0 || tr(1) != 6 - 2 * cy(a[lp].y));
            }
            if (cx(a[rp].x) == 1)
            {
                if (c1 != 1 || (tr(n) != 2 && tr(n) != 6)) { flag = 1; goto NXT; }
                a1[tr(n) / 2 - 1] = 1;
            }
            else
            {
                a1[cx(a[rp].x)] = c1 != 1 || !suf[6 - 2 * cx(a[rp].x)];
                a1[2 - cx(a[rp].x)] = suf[6 - 2 * cx(a[rp].x)] && (suf[6 - 2 * cx(a[rp].x)] != d1 || tr(n) != cx(a[rp].x) * 2 + 2);
            }

            // cout << a0[0] << ' ' << a0[2] << ' ' << a1[0] << ' ' << a1[2] << '\n';
            if ((a0[0] && a1[0]) || (a0[2] && a1[2])) { flag = 1; goto NXT; }
            bool f1 = 1, f2 = 1;
            if (a0[0]) f1 = 0; if (a0[2]) f2 = 0;
            if (a1[0]) f2 = 0; if (a1[2]) f1 = 0;
            // cout << f1 << " " << f2 << "\n";
            if (lp + 1 < rp && qt[k].mid[0][0]) f1 = 0;
            if (lp + 1 < rp && qt[k].mid[0][1]) f2 = 0;
            // cout << f1 << ' ' << f2 << "\n";
            flag |= !(f1 || f2);
        }
        NXT:
        lp = qt[k].lp[1], rp = qt[k].rp[1];
        if (lp <= rp)
        {
            memset(pre, 0, sizeof(pre)), memset(suf, 0, sizeof(suf));
            int d0 = qt[k].d0[1], d1 = qt[k].d1[1], c0 = qt[k].pcnt[1], c1 = qt[k].scnt[1];
            bool a0[3] = {0}, a1[3] = {0};

            if (qt[k].pre[0] < lp) pre[2] = qt[k].pre[0];
            if (qt[k].pre[1] < lp) pre[6] = qt[k].pre[1];
            if (qt[k].suf[0] > rp) suf[2] = qt[k].suf[0];
            if (qt[k].suf[1] > rp) suf[6] = qt[k].suf[1];

            if (lp == rp) { flag |= (c0 != 1 || (tr(1) != 2 && tr(1) != 6)) && (c1 != 1 || (tr(n) != 2 && tr(n) != 6)); goto END; }

            if (cx(a[lp].x) == 1)
            {
                if (c0 != 1 || (tr(1) != 2 && tr(1) != 6)) { flag = 1; goto END; }
                a0[tr(1) / 2 - 1] = 1;
            }
            else
            {
                a0[cx(a[lp].x)] = c0 != 1 || !pre[6 - 2 * cx(a[lp].x)];
                a0[2 - cx(a[lp].x)] = pre[6 - 2 * cx(a[lp].x)] && (pre[6 - 2 * cx(a[lp].x)] != d0 || tr(1) != cx(a[lp].x) * 2 + 2);
            }
            if (cy(a[rp].y) == 1)
            {
                if (c1 != 1 || (tr(n) != 2 && tr(n) != 6)) { flag = 1; goto END; }
                a1[3 - tr(n) / 2] = 1;
            }
            else
            {
                a1[cy(a[rp].y)] = c1 != 1 || !suf[cy(a[rp].y) * 2 + 2];
                a1[2 - cy(a[rp].y)] = suf[cy(a[rp].y) * 2 + 2] && (suf[cy(a[rp].y) * 2 + 2] != d1 || tr(n) != 6 - 2 * cx(a[rp].y));
            }

            // cout << a0[0] << ' ' << a0[2] << ' ' << a1[0] << ' ' << a1[2] << '\n';
            if ((a0[0] && a1[0]) || (a0[2] && a1[2])) { flag = 1; goto END; }
            bool f1 = 1, f2 = 1;
            if (a0[0]) f2 = 0; if (a0[2]) f1 = 0;
            if (a1[0]) f1 = 0; if (a1[2]) f2 = 0;
            if (lp + 1 < rp && qt[k].mid[1][0]) f1 = 0;
            if (lp + 1 < rp && qt[k].mid[1][1]) f2 = 0;
            flag |= !(f1 || f2);
        }
        END:
        if (flag) cout << qt[k].id << ' ';
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 11
Accepted

Test #1:

score: 11
Accepted
time: 0ms
memory: 26136kb

input:

2 10
171631799 561094698
171631799 867698918
126573648 561094698
171631799 867698918
171631799 561094698
126573648 561094698
126573648 561094698
171631799 561094698
126573648 561094698
126573648 561094698
126573648 561094698
171631799 561094698

output:

2 3 6 10 

result:

ok 4 number(s): "2 3 6 10"

Test #2:

score: 11
Accepted
time: 0ms
memory: 28184kb

input:

3 10
713180371 43103927
713180371 136832929
853543805 251852293
892623928 251852293
713180371 136832929
713180371 43103927
853543805 43103927
892623928 136832929
713180371 43103927
853543805 43103927
892623928 136832929
713180371 43103927
892623928 251852293

output:

2 3 6 9 

result:

ok 4 number(s): "2 3 6 9"

Test #3:

score: 11
Accepted
time: 0ms
memory: 28220kb

input:

4 10
254412080 855555783
254412080 534954259
610506813 184822793
804271098 233942602
804271098 233942602
536633825 184822793
254412080 855555783
804271098 233942602
536633825 233942602
254412080 855555783
804271098 534954259
610506813 534954259
536633825 184822793
536633825 855555783

output:

1 3 4 6 7 8 

result:

ok 6 numbers

Test #4:

score: 11
Accepted
time: 0ms
memory: 26184kb

input:

5 10
148547041 170447714
617759855 170447714
617759855 963162312
148547041 948767426
423489361 460053818
423489361 460053818
817714720 948767426
617759855 673099807
617759855 963162312
617759855 673099807
423489361 460053818
423489361 460053818
817714720 948767426
817714720 170447714
148547041 67309...

output:

1 4 6 7 

result:

ok 4 number(s): "1 4 6 7"

Test #5:

score: 11
Accepted
time: 0ms
memory: 28216kb

input:

6 10
452189481 369706489
974106249 369706489
152471743 55874110
152471743 7767562
623180600 783682263
116778263 783682263
974106249 369706489
452189481 7767562
623180600 7767562
116778263 783682263
330861484 7767562
452189481 640079581
974106249 640079581
623180600 783682263
974106249 7767562
116778...

output:

1 4 8 

result:

ok 3 number(s): "1 4 8"

Test #6:

score: 11
Accepted
time: 0ms
memory: 26192kb

input:

7 10
546365360 29458595
459505526 682968936
892069847 113227141
892069847 682968936
459505526 895773339
436538726 29458595
892069847 29458595
892069847 21442381
200908509 682968936
84249914 782064261
691849455 682968936
691849455 682968936
691849455 21442381
691849455 682968936
691849455 21442381
84...

output:


result:

ok 0 number(s): ""

Test #7:

score: 11
Accepted
time: 0ms
memory: 28232kb

input:

8 10
53884460 816621582
931458006 534340303
53884460 621933704
317941616 487589985
53884460 793793344
831491668 487589985
53884460 816621582
53884460 417129074
831491668 417129074
317941616 534340303
395845824 793793344
395845824 417129074
317941616 166559933
100528187 487589985
83144683 816621582
8...

output:

2 10 

result:

ok 2 number(s): "2 10"

Test #8:

score: 11
Accepted
time: 0ms
memory: 28312kb

input:

9 10
703128946 628411749
703128946 876135124
678057110 783023566
563107567 908344997
255577987 177945114
703128946 177945114
519769912 951772210
678057110 470396423
703128946 470396423
563107567 783023566
813952930 470396423
230207898 177945114
230207898 628411749
519769912 555485281
703128946 78302...

output:

1 6 

result:

ok 2 number(s): "1 6"

Test #9:

score: 11
Accepted
time: 4ms
memory: 26180kb

input:

10 10
411828800 587312736
368564282 297078085
368564282 265187364
287645241 405039514
368564282 535066135
368564282 265187364
701629305 581674146
894581821 581674146
600278299 347261251
368564282 390901645
633230417 151902557
287645241 297078085
1782717 405039514
287645241 587312736
894581821 587312...

output:

2 5 7 

result:

ok 3 number(s): "2 5 7"

Test #10:

score: 11
Accepted
time: 0ms
memory: 28180kb

input:

11 10
594865443 637250974
223004376 637250974
785025296 887146590
120666718 887146590
31665956 652873089
594865443 887146590
1682073 112213166
31665956 121276446
785025296 121276446
28305142 652873089
28305142 661968377
1682073 120498688
938018458 887146590
120666718 112213166
28305142 112213166
223...

output:

10 

result:

ok 1 number(s): "10"

Test #11:

score: 11
Accepted
time: 0ms
memory: 28220kb

input:

12 10
39186066 168002748
671722214 32295292
39186066 469855569
442075770 469855569
689698028 968471023
3489285 168002748
671722214 968471023
182809077 689539890
481317320 742954502
265274602 32295292
265274602 26013512
481317320 742954502
976556207 168425358
689698028 32295292
749415058 545907259
24...

output:

10 

result:

ok 1 number(s): "10"

Test #12:

score: 11
Accepted
time: 0ms
memory: 28160kb

input:

13 10
527355089 377970728
552459003 455747923
709625462 510634723
552459003 377970728
731571039 951161417
232811148 951161417
552459003 658700181
232811148 377970728
518940837 455747923
455586174 378372201
219157258 378372201
219157258 377970728
709625462 385691279
455586174 510634723
915002219 1039...

output:

1 4 7 8 10 

result:

ok 5 number(s): "1 4 7 8 10"

Test #13:

score: 11
Accepted
time: 0ms
memory: 28256kb

input:

14 10
118092342 284486250
927338949 433938384
402661724 978896809
647730583 672355271
31848729 951232518
735207774 379785691
647730583 976797409
118092342 976797409
16895438 951232518
266079358 317991591
402661724 759687663
927338949 672355271
384578818 379785691
927338949 675446949
647730583 672355...

output:

1 2 9 

result:

ok 3 number(s): "1 2 9"

Test #14:

score: 11
Accepted
time: 0ms
memory: 28240kb

input:

15 10
180664786 545082798
348151122 545082798
945365791 568927334
87112728 22695274
969050024 993697033
76897725 568927334
946081941 721317554
736012091 124380018
76897725 993697033
969050024 297352406
87112728 22695274
477303819 152140956
497190005 127179215
477303819 957952273
946081941 297352406
...

output:

2 3 

result:

ok 2 number(s): "2 3"

Test #15:

score: 11
Accepted
time: 0ms
memory: 26208kb

input:

16 10
950185079 359470460
717527338 766264034
950185079 464367361
702133494 562464640
47221737 933850433
804214161 68526353
835127535 923127189
663871966 429877028
663871966 933850433
663871966 860592052
717527338 159513156
817202184 970491880
835127535 475614319
519002985 475614319
109565532 137441...

output:

5 9 

result:

ok 2 number(s): "5 9"

Test #16:

score: 11
Accepted
time: 0ms
memory: 28156kb

input:

17 10
785164241 654900960
360828785 824839755
439791874 641288092
577364156 862808499
668131950 862808499
893897612 712643610
893897612 596494049
736363695 306279255
668131950 262689126
141356696 306279255
141356696 559915287
785164241 712643610
785164241 862808499
785164241 91314622
657093012 89959...

output:

1 2 4 7 8 

result:

ok 5 number(s): "1 2 4 7 8"

Test #17:

score: 11
Accepted
time: 2ms
memory: 30264kb

input:

18 10
634436200 539568435
939344787 325688918
488541626 821095697
430879210 182007328
634436200 676635380
863100947 105320937
634436200 259039153
155697449 650750783
863100947 290661066
904360323 275647130
148773803 836392810
155697449 275647130
904360323 325688918
242889289 395936619
863100947 8363...

output:

4 5 8 10 

result:

ok 4 number(s): "4 5 8 10"

Test #18:

score: 11
Accepted
time: 0ms
memory: 24156kb

input:

19 10
643978171 286398879
496772316 971744093
955019965 629209809
874944857 162312003
813096582 680350320
973954693 690315188
387049024 971744093
817521662 629209809
17782710 227578391
308611155 855159132
817521662 286398879
222858816 971744093
222858816 532541541
704414451 629209809
17782710 227578...

output:


result:

ok 0 number(s): ""

Test #19:

score: 11
Accepted
time: 0ms
memory: 28228kb

input:

20 10
339497023 613254335
277080109 869002717
498404000 182716214
838620251 613254335
774235215 599908689
321477480 52537358
406499846 787324761
498404000 867048589
339497023 265303890
653823018 594937507
277080109 856711907
774235215 150629026
339497023 613254335
845764830 867048589
339497023 85671...

output:

5 9 

result:

ok 2 number(s): "5 9"

Test #20:

score: 11
Accepted
time: 0ms
memory: 26196kb

input:

2 1
573537298 133184345
819019960 446972624
573537298 133184345

output:

1 

result:

ok 1 number(s): "1"

Test #21:

score: 11
Accepted
time: 0ms
memory: 26188kb

input:

2 10
215463781 963544789
417194171 381706359
215463781 381706359
417194171 963544789
417194171 381706359
215463781 381706359
215463781 381706359
215463781 381706359
417194171 963544789
215463781 381706359
417194171 963544789
215463781 381706359

output:

1 2 4 5 6 7 8 9 10 

result:

ok 9 numbers

Test #22:

score: 11
Accepted
time: 0ms
memory: 24144kb

input:

2 10
347064832 492954369
276208042 238639351
347064832 492954369
276208042 492954369
347064832 238639351
276208042 492954369
276208042 238639351
276208042 492954369
347064832 492954369
276208042 492954369
347064832 238639351
347064832 492954369

output:

1 5 7 10 

result:

ok 4 number(s): "1 5 7 10"

Test #23:

score: 11
Accepted
time: 0ms
memory: 24136kb

input:

2 10
59424469 214378961
467302957 920237929
467302957 214378961
467302957 920237929
467302957 214378961
467302957 920237929
467302957 214378961
467302957 214378961
467302957 920237929
467302957 214378961
467302957 920237929
467302957 920237929

output:

2 4 7 9 10 

result:

ok 5 number(s): "2 4 7 9 10"

Test #24:

score: 11
Accepted
time: 0ms
memory: 28160kb

input:

3 10
199016579 737474160
269172900 902060853
363682951 999857037
199016579 999857037
363682951 737474160
363682951 737474160
199016579 737474160
363682951 999857037
363682951 902060853
363682951 737474160
199016579 737474160
269172900 902060853
269172900 737474160

output:

4 5 8 9 

result:

ok 4 number(s): "4 5 8 9"

Test #25:

score: 11
Accepted
time: 0ms
memory: 28228kb

input:

3 10
546485825 847511917
181508698 729251744
262746395 577803673
546485825 729251744
546485825 577803673
262746395 847511917
546485825 729251744
546485825 577803673
262746395 577803673
546485825 847511917
262746395 577803673
181508698 847511917
181508698 577803673

output:

6 7 8 10 

result:

ok 4 number(s): "6 7 8 10"

Test #26:

score: 11
Accepted
time: 3ms
memory: 26124kb

input:

3 10
237380807 513263480
564217004 186570115
980960156 646344876
980960156 646344876
237380807 646344876
980960156 646344876
980960156 513263480
980960156 513263480
564217004 513263480
980960156 186570115
237380807 513263480
237380807 513263480
980960156 186570115

output:

1 3 6 8 9 

result:

ok 5 number(s): "1 3 6 8 9"

Test #27:

score: 11
Accepted
time: 0ms
memory: 30268kb

input:

15 10
624534653 795252871
948654092 55283897
925850942 516359844
291755097 717356990
550592491 128816565
821582441 517445939
994534468 342358076
26658991 396148487
649608935 585141111
323180864 608811044
265317796 85810941
124933870 521198693
547685531 600579720
271150336 559571739
242219192 7700636...

output:

1 2 3 4 8 9 

result:

ok 6 numbers

Test #28:

score: 11
Accepted
time: 0ms
memory: 28188kb

input:

16 10
83190470 209266752
880371594 540332431
77621971 311011586
207583928 515840494
210164058 16324657
557379175 66621069
583090455 503874482
155148044 798469757
997210630 599613989
425284838 540392415
814293641 704949575
371097849 755590192
748854182 185159646
764105570 723184963
281807551 22356411...

output:

1 2 3 4 5 6 7 9 10 

result:

ok 9 numbers

Test #29:

score: 11
Accepted
time: 0ms
memory: 30284kb

input:

17 10
335815281 733974183
996064097 204520072
806805395 978835797
278538265 788397455
993251528 550268353
598157139 171152822
752267659 708459589
720836211 683278789
104083774 172399908
396138427 816227937
454892965 632042288
630038886 668199869
907561802 996410213
244931242 610519539
474601248 7303...

output:

1 6 8 

result:

ok 3 number(s): "1 6 8"

Test #30:

score: 11
Accepted
time: 3ms
memory: 26192kb

input:

18 10
461958391 283363776
820708759 240820111
809183522 564946300
274367350 887675067
808876603 652655193
242336368 71989816
35682865 592736787
598975260 11034644
432130229 841406481
617636775 764446022
39223975 938369951
608686441 406829225
979705068 458377101
609019396 321322678
993501055 30534219...

output:

1 2 3 5 6 7 8 9 10 

result:

ok 9 numbers

Test #31:

score: 11
Accepted
time: 0ms
memory: 28232kb

input:

19 10
935306669 629155511
75497873 924414411
568314611 976194131
623493055 355890466
492224421 999834286
553317256 546504008
409428707 857511314
933067983 202850910
458115220 344652086
144924200 447572677
301600067 34784059
519123285 847853731
447663066 411079314
846416609 480411419
22568709 1531818...

output:

1 2 3 4 5 6 7 9 10 

result:

ok 9 numbers

Test #32:

score: 11
Accepted
time: 0ms
memory: 28244kb

input:

20 10
847175920 439365704
473215562 166583238
625362454 43314630
918168962 805367197
669794952 141443774
551725106 388869509
256958552 6665321
795177606 869847992
903617816 725384164
355322010 664242041
828642286 886444867
100880811 648469308
357482546 290363154
804925144 953197840
600535575 1891279...

output:

2 3 4 6 7 8 

result:

ok 6 numbers

Test #33:

score: 11
Accepted
time: 0ms
memory: 28236kb

input:

20 10
1 5
10 16
20 12
8 6
12 9
3 13
11 15
4 1
19 20
13 2
16 7
5 8
9 4
18 3
17 14
6 10
2 17
14 18
15 11
7 19
7 17
10 18
9 11
18 12
14 1
1 17
9 13
10 14
2 4
3 14

output:

1 2 3 4 7 8 9 10 

result:

ok 8 numbers

Test #34:

score: 11
Accepted
time: 0ms
memory: 30344kb

input:

20 10
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
17 17
18 18
19 19
20 20
1 1
20 20
2 5
4 4
17 6
20 20
6 20
3 3
5 12
14 14

output:

1 2 4 6 8 10 

result:

ok 6 numbers

Test #35:

score: 11
Accepted
time: 0ms
memory: 30292kb

input:

20 10
1 20
2 19
3 18
4 17
5 16
6 15
7 14
8 13
9 12
10 11
11 10
12 9
13 8
14 7
15 6
16 5
17 4
18 3
19 2
20 1
1 1
1 20
20 1
20 20
3 17
15 5
12 1
10 6
3 3
18 16

output:

1 4 5 6 7 8 9 10 

result:

ok 8 numbers

Test #36:

score: 11
Accepted
time: 0ms
memory: 26192kb

input:

20 10
647485976 833063145
962065068 658413630
729055030 89008090
552814579 367567398
962065068 658413630
57744310 463674984
962065068 658413630
190454651 801934060
57744310 463674984
190454651 801934060
647485976 833063145
962065068 658413630
729055030 89008090
57744310 463674984
57744310 463674984
...

output:

1 4 6 8 9 

result:

ok 5 number(s): "1 4 6 8 9"

Test #37:

score: 11
Accepted
time: 3ms
memory: 26140kb

input:

20 10
7 9
6 10
7 9
8 8
7 9
6 9
6 9
7 9
7 10
6 9
6 10
5 9
7 9
6 9
5 10
6 11
5 11
5 10
6 11
7 9
8 8
8 9
8 10
9 8
7 9
7 10
10 8
10 7
10 6
11 8

output:

2 3 5 6 

result:

ok 4 number(s): "2 3 5 6"

Test #38:

score: 11
Accepted
time: 0ms
memory: 28192kb

input:

20 10
9 7
10 5
9 5
8 8
10 6
9 6
10 6
10 7
9 5
10 6
11 7
9 6
10 5
11 7
9 6
10 7
11 7
9 7
10 6
10 5
8 8
8 9
8 6
9 8
7 9
7 6
10 8
6 7
10 6
5 8

output:

3 4 7 9 

result:

ok 4 number(s): "3 4 7 9"

Test #39:

score: 11
Accepted
time: 0ms
memory: 30268kb

input:

20 10
5 10
6 9
8 7
6 11
6 11
6 11
6 9
5 11
5 9
6 11
5 10
5 9
6 11
7 11
5 10
7 10
7 11
7 8
5 11
6 9
8 8
8 9
8 10
7 8
9 9
7 10
6 8
6 7
10 10
5 8

output:

2 3 6 7 8 10 

result:

ok 6 numbers

Test #40:

score: 11
Accepted
time: 0ms
memory: 28160kb

input:

20 10
11 7
10 5
8 7
10 7
10 5
10 5
11 7
10 6
9 7
9 7
10 7
11 7
11 7
11 5
11 5
10 7
11 6
7 8
10 7
10 6
8 8
8 9
8 6
7 8
7 7
9 10
6 8
10 7
6 10
11 8

output:

3 5 8 10 

result:

ok 4 number(s): "3 5 8 10"

Test #41:

score: 11
Accepted
time: 3ms
memory: 26212kb

input:

20 10
11 5
9 5
11 5
8 9
9 7
9 7
11 5
11 5
11 6
11 6
9 8
9 6
11 6
11 6
9 7
10 6
9 5
11 5
9 5
10 7
8 8
8 7
8 10
9 8
7 7
9 6
6 8
10 9
6 10
11 8

output:

4 6 8 10 

result:

ok 4 number(s): "4 6 8 10"

Test #42:

score: 11
Accepted
time: 0ms
memory: 28228kb

input:

20 10
7 11
7 11
7 10
6 9
6 10
7 10
6 10
7 11
7 9
7 11
8 9
7 9
5 9
6 10
5 9
7 11
9 8
5 10
5 10
6 10
8 8
8 7
8 6
9 8
7 9
9 10
10 8
6 9
10 10
5 8

output:

5 6 8 10 

result:

ok 4 number(s): "5 6 8 10"

Test #43:

score: 11
Accepted
time: 3ms
memory: 28316kb

input:

20 10
8 7
7 11
6 10
6 9
7 11
5 11
7 11
5 11
6 10
5 9
6 10
7 9
5 9
7 10
7 10
5 10
7 10
6 11
7 8
7 11
8 8
8 7
8 6
9 8
7 9
7 6
10 8
10 7
6 10
11 8

output:

1 5 9 

result:

ok 3 number(s): "1 5 9"

Test #44:

score: 11
Accepted
time: 0ms
memory: 28184kb

input:

20 10
9 8
9 7
11 5
11 6
9 7
9 7
10 6
10 6
10 7
10 7
9 5
11 5
10 6
9 6
10 6
10 5
10 6
11 6
11 5
8 9
8 8
8 9
8 6
9 8
9 7
9 6
6 8
6 9
10 6
5 8

output:

1 3 4 5 6 9 

result:

ok 6 numbers

Test #45:

score: 11
Accepted
time: 0ms
memory: 26200kb

input:

20 10
9 7
10 7
10 5
8 9
9 8
5 11
7 10
5 10
6 10
7 9
6 11
5 11
7 10
6 10
7 10
6 11
6 11
6 11
6 11
7 10
8 8
8 9
8 6
7 8
9 7
9 6
6 8
10 7
6 10
11 8

output:

1 2 4 5 7 8 9 

result:

ok 7 numbers

Subtask #2:

score: 38
Accepted

Dependency #1:

100%
Accepted

Test #46:

score: 38
Accepted
time: 0ms
memory: 28292kb

input:

1500 10
401134743 898594342
739681625 898594342
842492194 569404274
888451796 685104441
945772067 221545383
142276409 691220027
618847410 643831161
16003964 98459610
713370318 64857580
724642432 4634850
273681220 854797105
989430408 833800077
514271483 906536506
13011218 464186337
807512695 78088298...

output:

1 2 6 

result:

ok 3 number(s): "1 2 6"

Test #47:

score: 38
Accepted
time: 4ms
memory: 30272kb

input:

1600 10
933582191 336495008
461620436 186999808
345579872 988069086
49626704 262546280
559588074 252137392
130131997 356874602
657557603 314943383
724926365 743965763
522148738 216365207
821938460 254227453
189386460 336987142
813625232 402587899
320823882 973493831
150859871 634285383
849379382 411...

output:

1 3 4 7 9 10 

result:

ok 6 numbers

Test #48:

score: 38
Accepted
time: 0ms
memory: 28264kb

input:

1700 10
268825522 651445219
372394758 520736010
780878865 355459372
938320730 570235537
837012553 542718246
510360226 969805444
398385643 822868917
504655413 237794042
134892998 792841787
619617894 353138044
984056476 90070486
513541687 20525207
477511733 505399428
761217858 342975394
8421166 573348...

output:

4 7 8 9 

result:

ok 4 number(s): "4 7 8 9"

Test #49:

score: 38
Accepted
time: 0ms
memory: 28268kb

input:

1800 10
642029300 233564193
976887706 478822967
206490042 850155848
830711038 257938544
509981940 859622254
559517681 797058592
776971561 648160301
904506037 357109149
863152696 712844141
260274145 737977711
573464951 212703203
859270067 289430998
743922492 723209573
970279967 301446178
153687709 50...

output:

1 5 9 10 

result:

ok 4 number(s): "1 5 9 10"

Test #50:

score: 38
Accepted
time: 0ms
memory: 32320kb

input:

1900 10
825602635 52650151
866650293 727151834
49970867 108190581
13700700 44510906
523083830 529933163
26634435 443037805
884549435 226492038
801694700 765008610
268700778 649920259
695492705 106305760
811980644 153846947
286037407 173408838
300631179 615831679
287137514 534905521
866650293 5843593...

output:

2 4 7 9 10 

result:

ok 5 number(s): "2 4 7 9 10"

Test #51:

score: 38
Accepted
time: 5ms
memory: 28204kb

input:

2000 10
239583537 194327848
337276200 579167831
992971115 457681310
58153709 766984625
550429831 187200521
996697473 470499583
155778433 438120690
533747714 200223673
975344767 298446236
103906926 242700826
249895157 548765582
722315242 109127349
344697959 235943941
28562418 62676666
162165971 67455...

output:

1 2 5 6 7 8 

result:

ok 6 numbers

Test #52:

score: 38
Accepted
time: 2ms
memory: 28276kb

input:

1800 10
387536330 209721826
390894731 521823087
809287255 680079590
32777165 904875615
254122498 871233040
607735338 185518803
671331222 237888347
339733785 626965936
307580555 777288206
939253725 633227531
683074471 462711578
774046201 219351683
236081441 60275595
316485055 244506122
294823876 1030...

output:

1 2 3 4 5 6 7 8 9 10 

result:

ok 10 numbers

Test #53:

score: 38
Accepted
time: 2ms
memory: 28256kb

input:

1900 10
911052008 447447389
841021022 634688035
944651890 258709859
891462897 212006838
320199172 642400574
964244188 78652971
19662495 819526836
376348174 126274974
434815998 403531920
125513839 480582509
749811755 103403256
602271080 529686970
837439174 859905304
492206478 615500105
263102272 9536...

output:

1 2 3 4 5 6 7 8 9 10 

result:

ok 10 numbers

Test #54:

score: 38
Accepted
time: 6ms
memory: 28264kb

input:

2000 10
291372897 886276819
365700003 411818987
812168540 840073013
236393171 345978194
962726876 937608906
16160423 876553748
397527240 504410188
60792581 194840261
200753455 379090975
19569269 769967083
234055148 695874581
365844083 551392738
8092323 814228473
820199547 603797811
431679259 2125871...

output:

1 2 3 4 5 6 7 8 9 10 

result:

ok 10 numbers

Test #55:

score: 38
Accepted
time: 0ms
memory: 28208kb

input:

1800 10
9392404 27366426
14926966 25464186
8220166 18925563
29861131 19353882
13199167 13488760
19078396 8799243
15151232 25337562
15308250 18800050
12606562 24228468
19522150 1455491
9802828 12238344
19078396 19401726
30505419 3500873
139870 3500873
29212036 3500873
22961661 15860516
13199167 19950...

output:

1 2 3 4 5 6 7 8 9 10 

result:

ok 10 numbers

Test #56:

score: 38
Accepted
time: 4ms
memory: 28252kb

input:

1900 10
11069544 28569259
8395730 30739947
6275579 11245309
9881932 24855559
1072682 26048411
9881932 8957646
14426606 20337971
4231078 29477784
12042125 4479426
1254044 2734368
18676525 25238150
11710597 27500225
2719991 17677835
5034634 19105854
13403700 5019656
11640220 15622836
8609815 10486774
...

output:

1 2 3 4 5 6 7 8 9 10 

result:

ok 10 numbers

Test #57:

score: 38
Accepted
time: 0ms
memory: 32328kb

input:

2000 10
29396400 19629084
18481165 12429158
8289863 27196133
5829188 26716056
13537663 779169
27259859 23223525
30086089 24980633
30048604 29006956
8880221 29267180
16216915 23673507
186517 12871012
18761618 21367329
24774599 14882865
4041254 21367329
27064670 14882865
5829188 15480518
8289863 30607...

output:

1 2 3 4 5 6 7 8 9 10 

result:

ok 10 numbers

Test #58:

score: 38
Accepted
time: 0ms
memory: 28252kb

input:

2000 10
937 193
730 1452
657 76
404 974
1919 1798
1605 1922
99 703
1578 1678
1912 1104
584 1587
1043 1296
831 583
375 562
690 1989
1565 502
693 1199
1243 1079
34 982
437 36
1479 1334
859 1011
1299 672
316 1022
1330 837
627 1068
268 1055
1118 345
346 1968
1574 1138
7 1089
641 362
417 381
1256 1155
19...

output:

1 2 3 4 5 6 7 8 9 10 

result:

ok 10 numbers

Test #59:

score: 38
Accepted
time: 4ms
memory: 28320kb

input:

2000 10
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
17 17
18 18
19 19
20 20
21 21
22 22
23 23
24 24
25 25
26 26
27 27
28 28
29 29
30 30
31 31
32 32
33 33
34 34
35 35
36 36
37 37
38 38
39 39
40 40
41 41
42 42
43 43
44 44
45 45
46 46
47 47
48 48
49 49
50 50
51 51
52 5...

output:

1 2 4 6 8 10 

result:

ok 6 numbers

Test #60:

score: 38
Accepted
time: 4ms
memory: 32340kb

input:

2000 10
1 2000
2 1999
3 1998
4 1997
5 1996
6 1995
7 1994
8 1993
9 1992
10 1991
11 1990
12 1989
13 1988
14 1987
15 1986
16 1985
17 1984
18 1983
19 1982
20 1981
21 1980
22 1979
23 1978
24 1977
25 1976
26 1975
27 1974
28 1973
29 1972
30 1971
31 1970
32 1969
33 1968
34 1967
35 1966
36 1965
37 1964
38 19...

output:

1 4 5 6 7 8 9 10 

result:

ok 8 numbers

Test #61:

score: 38
Accepted
time: 0ms
memory: 28248kb

input:

2000 10
591792934 616105615
752818974 143716789
293153789 672666291
591792934 616105615
148779494 570184902
499291018 343041370
752818974 143716789
148779494 570184902
379319777 549323017
293153789 672666291
156511112 814161446
499291018 343041370
752818974 143716789
293153789 672666291
499291018 34...

output:

1 2 3 4 5 6 7 8 9 10 

result:

ok 10 numbers

Test #62:

score: 38
Accepted
time: 0ms
memory: 28252kb

input:

2000 10
6 10
5 9
7 9
6 11
6 9
7 10
6 10
6 11
6 10
7 9
5 10
6 9
7 10
7 10
7 9
7 10
6 11
6 10
5 9
7 10
7 9
6 10
5 10
6 11
7 11
6 11
6 10
7 11
6 9
6 11
7 11
6 11
5 9
6 10
5 10
7 11
6 9
6 9
6 9
6 9
6 9
5 9
6 11
5 10
7 9
7 9
5 10
6 11
7 11
6 10
6 9
5 10
6 10
5 11
7 11
6 9
6 9
7 11
7 11
6 11
5 10
7 9
6 11...

output:

7 8 10 

result:

ok 3 number(s): "7 8 10"

Test #63:

score: 38
Accepted
time: 0ms
memory: 32252kb

input:

2000 10
10 5
9 6
10 7
9 6
10 7
9 5
11 5
10 6
11 7
11 6
11 7
11 6
10 7
9 7
9 6
11 5
10 6
10 6
11 7
9 5
9 6
10 7
10 5
9 6
11 6
11 7
11 6
9 6
11 7
10 7
10 6
9 7
10 6
9 7
10 6
10 6
10 5
10 6
9 7
10 5
9 7
9 5
10 6
10 7
9 5
11 6
9 6
11 7
9 5
11 5
10 5
9 6
9 7
9 6
10 7
10 5
9 6
11 6
9 5
9 7
10 6
9 6
10 7
9...

output:

2 3 4 7 8 

result:

ok 5 number(s): "2 3 4 7 8"

Test #64:

score: 38
Accepted
time: 4ms
memory: 30204kb

input:

2000 10
7 9
6 9
5 11
7 11
7 11
7 9
6 9
7 11
5 10
6 10
6 10
5 10
6 9
7 9
5 9
5 9
7 10
5 9
5 11
5 11
7 11
6 10
6 9
7 11
6 11
5 9
6 9
7 10
5 10
6 11
6 11
6 11
7 11
7 9
6 10
5 11
7 9
6 9
7 9
6 10
5 9
5 10
6 9
7 10
7 11
7 10
5 9
5 9
7 9
7 9
7 11
6 10
5 9
7 10
7 9
6 10
7 9
6 11
7 10
5 10
5 11
5 10
5 11
7 ...

output:

2 4 5 6 7 8 10 

result:

ok 7 numbers

Test #65:

score: 38
Accepted
time: 0ms
memory: 28308kb

input:

2000 10
10 7
10 5
11 7
9 6
10 6
9 6
11 6
10 6
11 7
9 5
10 6
10 7
11 6
10 7
9 7
11 6
10 7
10 6
10 7
10 6
11 6
11 6
10 7
10 6
9 6
10 7
10 5
11 7
11 7
10 5
10 7
10 7
10 7
11 5
11 6
9 5
11 6
9 7
9 5
9 7
10 7
9 6
10 5
11 7
9 5
9 5
11 5
9 5
9 6
11 7
10 5
11 6
11 6
9 5
9 7
11 6
11 7
9 6
11 5
10 6
9 7
10 7
...

output:

3 5 6 9 

result:

ok 4 number(s): "3 5 6 9"

Test #66:

score: 38
Accepted
time: 0ms
memory: 30336kb

input:

2000 10
10 7
10 7
9 6
11 7
11 5
9 5
10 5
9 6
9 7
9 5
9 6
10 7
11 5
11 6
11 6
10 5
11 5
9 5
9 5
10 7
9 5
10 7
10 7
11 6
9 5
11 5
10 6
11 5
10 5
11 6
11 6
11 5
11 6
11 5
11 6
11 7
10 5
9 5
10 5
10 6
11 6
10 6
11 5
9 7
9 5
11 7
9 5
9 6
9 5
9 7
10 7
11 5
10 5
10 6
9 7
9 5
11 6
9 7
9 5
11 6
9 5
11 7
9 5
...

output:

2 5 

result:

ok 2 number(s): "2 5"

Test #67:

score: 38
Accepted
time: 0ms
memory: 30236kb

input:

2000 10
6 11
5 9
6 10
6 9
6 9
7 9
7 10
7 11
6 11
6 11
7 11
7 10
5 9
7 10
6 11
6 11
6 9
6 10
6 10
5 9
7 11
6 9
6 11
6 9
6 10
5 9
7 10
5 11
5 11
7 10
6 10
5 10
5 11
5 9
7 11
6 10
7 10
7 10
7 11
7 10
7 9
7 9
5 9
5 11
7 9
5 11
5 11
6 9
7 10
5 10
5 11
5 11
6 9
6 10
7 10
7 9
7 11
7 11
5 11
6 11
6 10
5 10
...

output:

7 9 10 

result:

ok 3 number(s): "7 9 10"

Test #68:

score: 38
Accepted
time: 0ms
memory: 28264kb

input:

2000 10
8 7
7 9
6 11
6 10
5 9
7 11
7 9
6 9
6 11
5 10
7 11
6 11
7 9
7 11
5 9
5 10
7 11
6 10
7 9
5 10
5 9
6 11
6 10
7 10
7 9
5 9
5 9
7 10
7 9
6 11
7 9
7 11
6 10
6 11
6 9
6 9
5 9
7 11
7 11
7 10
7 9
7 9
7 11
7 9
5 11
6 10
5 11
6 11
7 9
7 10
5 10
6 9
6 11
5 10
6 9
5 10
7 11
7 11
6 10
7 11
6 9
6 11
5 11
5...

output:

1 3 5 8 9 10 

result:

ok 6 numbers

Test #69:

score: 38
Accepted
time: 0ms
memory: 26292kb

input:

2000 10
9 8
11 7
10 7
9 7
9 7
9 7
10 6
9 7
9 7
9 5
11 6
9 5
11 5
11 6
11 5
10 7
11 7
9 7
10 5
11 6
11 6
9 7
11 6
11 7
11 5
11 7
11 5
11 7
11 6
11 5
10 7
10 7
9 6
9 7
9 6
10 5
10 5
9 6
10 5
11 7
9 7
10 6
10 7
9 5
9 7
11 7
11 6
11 5
10 6
10 6
11 7
10 5
9 6
11 6
10 6
11 5
9 6
10 7
11 6
10 5
11 5
9 7
11...

output:

1 3 4 

result:

ok 3 number(s): "1 3 4"

Test #70:

score: 38
Accepted
time: 0ms
memory: 32256kb

input:

2000 10
9 7
11 5
9 6
10 7
10 7
11 6
11 7
9 6
9 5
9 7
10 7
11 5
10 5
11 6
9 7
10 5
9 5
10 7
10 6
11 6
11 5
11 6
11 6
9 5
10 6
10 5
10 6
10 6
9 6
10 5
11 5
11 5
9 5
11 5
10 6
10 7
10 6
9 6
10 7
9 6
9 6
11 6
10 6
9 6
9 7
11 6
9 6
9 7
11 6
11 6
11 5
10 6
10 6
9 7
10 6
9 5
11 7
9 6
10 6
10 5
10 7
9 6
11 ...

output:

1 2 3 4 5 6 7 8 9 10 

result:

ok 10 numbers

Subtask #3:

score: 22
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Test #71:

score: 22
Accepted
time: 171ms
memory: 74712kb

input:

150000 10
429397615 196539042
253788191 786385159
144814364 368410247
539186750 28998265
709395946 451949901
747504119 217288628
144253456 723931313
409006764 432647953
437137800 953770352
820178730 437810411
764271627 211460452
398777508 23054037
786701950 571743764
647382230 691039687
581509166 87...

output:

1 2 4 5 6 

result:

ok 5 number(s): "1 2 4 5 6"

Test #72:

score: 22
Accepted
time: 175ms
memory: 77972kb

input:

160000 10
815907773 688556533
328193051 354132109
827858861 377690093
606686130 166700159
105782643 296723364
433067299 766816876
46328628 653442171
95893505 135770019
864026570 20065385
812537395 24412688
893123904 281579324
858556559 31052476
15758169 945446076
737774519 827098173
672856895 755779...

output:

1 3 4 9 

result:

ok 4 number(s): "1 3 4 9"

Test #73:

score: 22
Accepted
time: 184ms
memory: 80224kb

input:

170000 10
577425468 532104445
393636494 54188066
944175537 931626116
946999048 218816681
83619102 387111374
42324322 407586148
286432180 910853680
836807251 263763936
380037161 913210452
622601268 881378296
180483719 757146083
768794144 33646285
859035020 847983937
833796622 857876972
174059290 2930...

output:

1 4 5 7 

result:

ok 4 number(s): "1 4 5 7"

Test #74:

score: 22
Accepted
time: 173ms
memory: 80304kb

input:

180000 10
475449178 536652311
13236240 927707504
352850653 574131835
733963494 218296379
992484526 74251001
36304702 874096048
207551492 981866035
133384436 478757128
332470246 680778451
111277156 613511114
671188149 146249372
459270983 109741174
401668496 248862246
822586685 814830370
710626076 304...

output:

4 9 

result:

ok 2 number(s): "4 9"

Test #75:

score: 22
Accepted
time: 212ms
memory: 82084kb

input:

190000 10
830905815 44014497
421588331 448655984
533648186 992504321
277350365 72896812
734292348 301183805
560049292 932174014
282759917 410938145
903972142 807487397
488314688 348056158
929887890 209513806
635536089 721199099
153995028 837135944
96379496 728688258
856027422 701370764
396696237 476...

output:

1 3 5 8 9 10 

result:

ok 6 numbers

Test #76:

score: 22
Accepted
time: 214ms
memory: 82856kb

input:

200000 10
241073146 208017712
268082755 540439555
217348135 258620577
76808365 937382350
405035548 767085695
331041252 254573432
152417600 436471572
210176530 134663636
886530614 788137616
528726989 884899837
80450105 299587307
253775314 803874611
627205073 704819192
945659901 670074798
815883219 69...

output:

6 8 

result:

ok 2 number(s): "6 8"

Test #77:

score: 22
Accepted
time: 224ms
memory: 80236kb

input:

180000 10
727989653 693467729
763471589 972775031
404642863 195502920
810050715 611503869
518494613 166944605
646043942 398513248
361266603 627686995
947613903 727998298
949309802 930401045
120355149 367012634
175865210 547751861
658054774 937406637
638824696 395864703
158770562 855345550
695024337 ...

output:

1 2 3 4 5 6 7 8 9 10 

result:

ok 10 numbers

Test #78:

score: 22
Accepted
time: 234ms
memory: 80228kb

input:

190000 10
233033058 540777749
768510667 517425682
362893106 706416233
158565149 374356967
718320676 778931970
339908 879450446
935893133 136134412
696733657 427326241
669405898 915436694
347204950 375776784
1815820 168596578
780543211 293599992
415341105 939673703
364677928 811197595
48951703 932447...

output:

1 2 3 4 5 6 7 8 9 10 

result:

ok 10 numbers

Test #79:

score: 22
Accepted
time: 240ms
memory: 82996kb

input:

200000 10
498879289 466255565
875371002 149246931
553841836 548734993
136206384 934412381
34826056 322444571
788740476 494405939
183017696 990153853
207494663 511777783
572053681 440922722
698927938 146928337
869671213 555066746
820270918 577959395
60907566 579849474
489408308 255272842
485146461 32...

output:

1 2 3 4 5 6 7 8 9 10 

result:

ok 10 numbers

Test #80:

score: 22
Accepted
time: 142ms
memory: 81508kb

input:

180000 10
2477044 994331
2038800 1994212
2280830 479535
474762 1407636
467952 1695532
1223614 2024015
864038 1847045
1755882 2006894
863122 852036
362566 1997713
1517745 413857
2323569 1701979
1354801 955627
1468185 2246010
203170 1034918
1695039 156305
1281639 2168943
445778 1449803
1179794 763923
...

output:

1 2 3 4 5 6 7 8 9 10 

result:

ok 10 numbers

Test #81:

score: 22
Accepted
time: 144ms
memory: 81440kb

input:

190000 10
2093815 185418
660014 10234
448501 1617838
1696567 324278
369451 1377312
1696567 2013412
369409 442854
930226 686558
1637438 645788
2019600 2210347
2121483 1826538
332659 1324453
1749341 1836431
8204 1459842
8690 558818
1696691 1675261
615602 760824
77306 2200787
1470121 139070
2101080 441...

output:

1 2 3 4 5 6 7 8 9 10 

result:

ok 10 numbers

Test #82:

score: 22
Accepted
time: 158ms
memory: 81904kb

input:

200000 10
2319433 511179
595920 525574
1687127 1521152
2378746 87014
1318855 1135756
1079319 249872
930170 2269205
214789 1538313
292194 1297763
536974 590539
405021 1733070
1332087 2053177
715059 2178057
1828519 2053177
2165762 861980
704124 1980513
1732214 926871
2312406 861980
169406 949288
50308...

output:

1 2 3 4 5 6 7 8 9 10 

result:

ok 10 numbers

Test #83:

score: 22
Accepted
time: 209ms
memory: 83092kb

input:

200000 10
140090 60947
194178 91826
69049 83912
13519 101086
46062 14454
134926 180499
56113 86844
199883 95212
160298 108285
198533 46105
173152 65313
22780 71012
131980 150830
6189 181689
144397 61361
68366 155549
10128 122321
149224 98667
196727 120722
50469 101558
110508 25907
141343 74610
14020...

output:

1 2 3 4 5 6 7 8 9 10 

result:

ok 10 numbers

Test #84:

score: 22
Accepted
time: 95ms
memory: 82276kb

input:

200000 10
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
17 17
18 18
19 19
20 20
21 21
22 22
23 23
24 24
25 25
26 26
27 27
28 28
29 29
30 30
31 31
32 32
33 33
34 34
35 35
36 36
37 37
38 38
39 39
40 40
41 41
42 42
43 43
44 44
45 45
46 46
47 47
48 48
49 49
50 50
51 51
52...

output:

1 2 4 6 8 10 

result:

ok 6 numbers

Test #85:

score: 22
Accepted
time: 111ms
memory: 82948kb

input:

200000 10
1 200000
2 199999
3 199998
4 199997
5 199996
6 199995
7 199994
8 199993
9 199992
10 199991
11 199990
12 199989
13 199988
14 199987
15 199986
16 199985
17 199984
18 199983
19 199982
20 199981
21 199980
22 199979
23 199978
24 199977
25 199976
26 199975
27 199974
28 199973
29 199972
30 199971...

output:

1 4 5 6 7 8 9 10 

result:

ok 8 numbers

Test #86:

score: 22
Accepted
time: 97ms
memory: 82216kb

input:

200000 10
38693490 592863320
116437328 728326914
349472146 186110376
122626131 196584755
122626131 196584755
940356736 53742497
672585370 493027203
116437328 728326914
122626131 196584755
774943154 667172326
199331396 378136030
38693490 592863320
767639780 322322842
116437328 728326914
122626131 196...

output:

1 2 3 4 5 6 7 8 9 10 

result:

ok 10 numbers

Test #87:

score: 22
Accepted
time: 86ms
memory: 81668kb

input:

200000 10
7 9
6 10
5 9
6 10
6 10
6 10
7 9
6 10
6 11
5 10
5 10
6 11
5 11
7 11
7 11
7 9
6 10
6 9
5 10
5 10
5 9
7 11
6 10
6 10
6 11
5 9
6 9
6 11
5 9
6 11
5 10
6 9
6 11
6 11
5 10
6 10
6 9
5 9
7 11
7 11
7 10
5 10
6 10
7 11
6 10
5 9
5 10
5 10
7 11
6 9
6 9
5 11
5 10
7 9
6 9
5 11
5 9
7 10
5 10
5 10
6 9
7 11...

output:

2 4 6 7 8 10 

result:

ok 6 numbers

Test #88:

score: 22
Accepted
time: 59ms
memory: 77936kb

input:

200000 10
9 6
11 6
10 5
9 7
11 6
10 7
11 6
10 5
10 6
11 7
9 7
9 5
10 5
10 5
11 7
10 7
9 6
10 5
11 7
9 7
10 6
9 6
9 7
11 7
9 6
9 7
10 7
9 5
11 7
10 5
10 5
10 6
9 5
11 6
11 6
10 6
10 7
10 5
9 7
9 6
10 6
10 7
9 5
9 7
10 5
11 6
9 7
11 7
10 7
11 5
10 5
9 6
11 5
10 6
11 7
9 6
10 7
10 5
9 6
9 5
11 5
10 5
1...

output:


result:

ok 0 number(s): ""

Test #89:

score: 22
Accepted
time: 95ms
memory: 81800kb

input:

200000 10
7 11
6 11
7 9
7 9
6 9
5 9
7 11
7 10
5 11
7 11
7 9
7 10
7 10
7 11
6 9
6 11
5 11
5 10
7 9
7 10
7 9
7 9
5 11
7 9
5 9
7 9
6 11
6 11
6 11
6 9
7 11
7 11
7 9
6 11
6 10
6 11
6 10
5 9
7 11
6 10
7 9
6 10
6 10
7 9
5 9
6 10
6 10
5 11
5 10
7 11
5 11
6 11
5 10
6 9
7 9
6 9
6 11
6 9
7 11
7 10
6 10
7 10
5 ...

output:

3 4 6 

result:

ok 3 number(s): "3 4 6"

Test #90:

score: 22
Accepted
time: 94ms
memory: 79900kb

input:

200000 10
11 5
11 6
11 6
10 5
10 7
9 6
9 6
9 7
11 5
9 6
11 5
10 7
9 7
11 6
9 7
9 6
11 5
11 7
11 6
9 6
10 7
11 7
11 5
11 7
11 7
10 7
11 5
9 7
11 6
9 6
10 7
9 6
10 7
9 7
9 7
9 5
11 7
10 5
10 7
10 5
10 7
11 7
9 7
10 7
11 6
11 6
9 6
10 6
11 6
9 7
10 6
10 5
11 5
10 5
10 5
10 5
9 6
10 5
9 5
9 5
11 7
11 7
...

output:

3 5 7 

result:

ok 3 number(s): "3 5 7"

Test #91:

score: 22
Accepted
time: 102ms
memory: 81492kb

input:

200000 10
10 7
10 6
9 7
9 6
11 6
9 5
9 7
9 6
11 7
11 7
11 7
10 5
10 6
11 7
9 7
11 7
10 6
9 7
11 6
10 5
10 5
9 6
11 7
9 7
9 5
10 6
10 7
9 6
11 7
10 7
9 7
10 5
9 7
11 6
11 6
9 7
10 7
11 6
11 7
11 6
10 5
10 6
10 7
10 5
10 7
9 7
10 7
9 5
11 6
11 7
9 7
9 5
11 6
9 7
11 7
9 6
9 6
11 5
9 7
9 5
11 7
9 5
9 6
...

output:

2 3 4 7 8 

result:

ok 5 number(s): "2 3 4 7 8"

Test #92:

score: 22
Accepted
time: 93ms
memory: 82280kb

input:

200000 10
7 9
7 11
5 9
7 9
6 9
6 9
6 11
7 10
7 10
5 11
5 11
7 9
5 9
6 10
7 9
6 10
6 10
5 10
6 10
7 10
7 11
5 9
5 10
5 9
5 10
7 10
6 11
6 9
7 9
6 9
7 11
7 10
5 11
7 9
5 11
6 11
6 9
5 11
5 10
6 11
6 10
7 11
5 10
6 11
6 11
7 10
7 11
7 9
5 9
7 10
7 11
6 10
7 9
5 10
7 11
6 9
5 11
6 9
7 10
5 11
7 10
6 10
...

output:

3 4 7 10 

result:

ok 4 number(s): "3 4 7 10"

Test #93:

score: 22
Accepted
time: 88ms
memory: 82360kb

input:

200000 10
8 7
6 11
6 9
5 9
5 9
7 10
7 11
5 10
6 11
5 9
6 11
5 9
7 11
5 11
5 10
7 9
6 9
7 9
7 9
7 9
7 9
5 9
7 9
5 9
7 10
6 9
7 9
5 10
7 10
7 11
5 10
6 10
5 10
6 10
7 10
5 10
7 10
6 9
7 10
7 11
5 10
6 10
7 10
7 10
7 10
6 11
6 9
6 9
5 10
5 10
5 11
5 11
6 9
6 10
6 11
5 9
5 10
5 11
7 10
5 11
5 11
7 9
7 9...

output:

1 5 7 9 10 

result:

ok 5 number(s): "1 5 7 9 10"

Test #94:

score: 22
Accepted
time: 92ms
memory: 81828kb

input:

200000 10
9 8
10 7
11 6
10 5
11 5
9 7
11 7
9 6
9 6
11 6
11 5
11 6
11 6
10 7
11 7
11 5
10 6
11 6
9 5
9 7
11 7
10 7
10 7
9 5
10 7
9 5
11 5
11 6
9 6
9 5
9 5
10 7
9 7
11 5
9 6
9 6
9 5
9 6
9 7
11 6
11 6
10 6
9 6
11 7
11 5
11 6
11 5
10 6
11 6
10 7
9 7
11 6
9 5
11 5
11 5
11 6
9 6
11 7
11 6
10 6
11 7
11 5
1...

output:

1 2 5 8 10 

result:

ok 5 number(s): "1 2 5 8 10"

Test #95:

score: 22
Accepted
time: 99ms
memory: 79928kb

input:

200000 10
10 5
9 5
11 7
9 7
11 5
11 7
10 7
10 7
9 5
9 6
11 6
11 5
10 5
9 5
10 7
10 7
11 5
9 5
10 7
11 7
11 6
10 5
10 7
9 6
9 6
10 5
9 6
9 6
11 5
11 5
9 7
11 7
11 5
11 6
9 5
10 7
9 5
9 6
10 7
11 5
9 6
9 7
11 7
11 5
11 6
9 7
9 7
11 6
9 7
11 7
9 7
9 5
10 5
9 6
11 5
11 6
9 5
9 7
9 6
10 7
11 6
9 5
11 6
1...

output:

1 2 3 4 5 6 7 8 9 10 

result:

ok 10 numbers

Subtask #4:

score: 29
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Test #96:

score: 29
Accepted
time: 672ms
memory: 86756kb

input:

150000 200000
554840280 450180271
129755190 936539702
636029974 100931595
347482033 941182758
424159440 989863886
696730935 668647576
963026851 795393731
584491123 313196560
272517468 169799915
695813985 399916082
208857226 922765084
533199689 430981114
166699253 374247795
578418513 419435154
294227...

output:

5 8 9 12 15 16 17 19 20 21 22 23 25 26 27 32 33 40 43 46 47 48 50 51 52 55 61 63 66 70 72 76 79 82 83 85 86 88 91 94 95 97 98 99 102 103 109 111 114 115 118 119 125 126 127 130 132 138 142 144 147 148 149 150 154 156 157 158 160 162 164 166 167 171 176 179 180 181 185 187 189 192 194 196 200 209 211...

result:

ok 80181 numbers

Test #97:

score: 29
Accepted
time: 684ms
memory: 92780kb

input:

160000 200000
964840689 890753281
28316914 630883814
522451989 871899608
147921988 415914644
84486619 796686598
432858799 754790681
255645216 438676341
970549535 928815871
603919592 610653655
597931265 410394132
802945872 291781420
343730460 768366788
726574223 921938712
295943849 562181199
16490787...

output:

1 2 4 5 12 13 17 19 23 28 35 36 37 38 39 41 47 48 55 57 63 64 67 69 73 74 75 76 77 78 83 84 86 87 94 95 99 100 101 102 104 105 107 110 119 121 125 126 130 131 132 139 140 143 150 155 156 157 161 162 164 168 169 170 173 176 177 182 184 185 187 188 190 196 198 199 200 201 202 206 210 211 213 216 224 2...

result:

ok 79953 numbers

Test #98:

score: 29
Accepted
time: 719ms
memory: 92248kb

input:

170000 200000
350061411 338756662
174393043 463310349
308708027 113337455
894989479 530862424
571052926 471872475
1354742 490057071
709901823 821816883
454860980 400426503
344089837 713612263
927373930 505959529
351923669 999161852
258127224 592159637
19031106 512430211
737965619 277517786
144266339...

output:

2 5 7 8 9 11 14 15 16 17 18 21 25 26 27 33 34 35 38 39 40 44 47 49 50 53 55 58 59 61 63 64 65 69 70 71 74 76 78 79 80 81 82 83 85 89 90 95 97 99 100 104 106 112 113 114 115 116 119 120 122 124 126 128 131 132 134 142 147 149 150 151 152 155 157 160 164 165 168 171 172 174 175 177 180 183 186 188 190...

result:

ok 79521 numbers

Test #99:

score: 29
Accepted
time: 750ms
memory: 95728kb

input:

180000 200000
875233799 499154419
972804050 290613340
792919392 304353712
553321687 600710811
983836536 822296197
671773344 192874307
983638205 457051611
491811123 109956990
226306259 795272169
897569919 609275644
13896724 252275363
718205786 557657489
755589814 377967362
939165761 947994416
9928179...

output:

3 6 8 10 15 17 18 20 26 29 33 35 37 43 45 47 50 51 54 55 57 59 60 61 62 67 68 71 75 77 78 84 86 90 91 94 96 98 102 104 106 107 108 109 112 116 117 118 121 123 124 125 130 131 132 134 138 139 140 146 148 150 152 156 159 160 162 164 165 166 169 171 173 176 178 180 182 183 184 186 187 188 189 190 191 1...

result:

ok 79510 numbers

Test #100:

score: 29
Accepted
time: 775ms
memory: 95772kb

input:

190000 200000
917780169 337976184
377059645 574122000
571339970 247074015
592346314 719513000
1341479 285704240
90474409 826677871
775123160 325719776
446074818 477133510
575775843 280043143
726369091 468708661
143152658 587048680
392058297 840967330
29965745 544923386
9159246 31162616
746362267 983...

output:

4 10 13 14 17 18 23 26 29 32 34 39 42 43 44 45 50 51 52 53 54 56 61 64 67 69 70 71 72 74 80 83 85 88 91 94 95 97 98 100 109 111 113 118 126 127 130 135 141 142 143 145 148 150 152 153 154 156 157 162 163 171 173 176 177 180 181 182 184 186 191 195 198 200 205 207 208 209 210 211 213 214 217 218 219 ...

result:

ok 79654 numbers

Test #101:

score: 29
Accepted
time: 791ms
memory: 94560kb

input:

200000 200000
207195955 162377530
972394896 167558257
770815185 73410472
227526784 948293116
117434463 324106529
505671534 182003692
724337591 782151916
684152386 10834894
754253529 403170449
902049520 637178731
854546342 812285084
518272205 837853391
462104188 715290933
131116914 835654250
29911181...

output:

2 4 6 8 12 13 14 15 16 19 21 23 27 29 30 32 34 40 49 55 57 58 61 63 65 66 67 69 74 75 76 77 78 79 81 84 88 89 93 96 97 98 105 106 107 109 110 111 118 120 121 122 124 125 127 128 130 135 136 142 143 145 147 151 152 155 156 159 162 165 169 170 173 174 177 180 181 183 185 186 189 196 197 198 201 206 20...

result:

ok 80117 numbers

Test #102:

score: 29
Accepted
time: 1082ms
memory: 107332kb

input:

180000 200000
682897139 358054774
684771011 142168053
405832352 901800509
160344235 716611251
987824028 38612710
751635697 93033988
282943203 775574016
792971142 186751384
264439580 717766103
94282689 554052633
916308401 886689138
523240726 972537810
747214916 525225675
387991157 750385122
360192471...

output:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 ...

result:

ok 199979 numbers

Test #103:

score: 29
Accepted
time: 1118ms
memory: 110740kb

input:

190000 200000
268005404 170850831
948931227 544405132
185276179 60341282
949553143 646951442
950072109 440344719
455928326 155833918
633682979 60660744
52084126 340784020
404501591 150882430
61943857 497380285
758132714 869365538
759145712 925684338
927126715 630268607
580777182 774126488
359162748 ...

output:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 ...

result:

ok 199972 numbers

Test #104:

score: 29
Accepted
time: 1148ms
memory: 107424kb

input:

200000 200000
745783133 407431967
417064914 906296581
819201570 475896545
593514802 696179975
509402546 312075966
755342400 801503044
21065172 198617456
560678716 397844051
855246813 102096144
597481677 182730027
430597246 749002215
733675601 937821633
704417532 878516168
459571150 534310290
4249108...

output:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 ...

result:

ok 199978 numbers

Test #105:

score: 29
Accepted
time: 1500ms
memory: 114352kb

input:

180000 200000
1582785 985427
2054914 2221684
2038650 2359431
1146235 1043733
2153806 297663
306761 577964
2081704 2249295
1112397 1994248
284798 66713
1563787 460788
809908 1057520
1178278 1343460
1802724 353868
1580055 1727595
563565 702045
3913 1578762
1430890 1620740
1660237 1508702
671840 461821...

output:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 ...

result:

ok 200000 numbers

Test #106:

score: 29
Accepted
time: 1529ms
memory: 114416kb

input:

190000 200000
547267 1255728
33298 2250962
1991659 1348780
33298 490075
1522153 587997
1978445 1679557
864776 880450
2187386 2225454
717316 1751971
2072263 1574429
942355 655620
1573348 929405
1626153 1199363
87630 621894
121152 1622209
1166279 1202377
1944544 1724524
1271385 152637
1759941 2094081
...

output:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 ...

result:

ok 199997 numbers

Test #107:

score: 29
Accepted
time: 1537ms
memory: 114580kb

input:

200000 200000
1182321 1022445
1899018 1163780
767294 2238821
586232 2036174
2095246 1778759
877592 476275
406003 2014284
913923 1977317
1038989 1510060
1691991 591019
1936598 1905117
1066507 163244
14611 103525
621156 522915
766116 166996
110270 768697
1492892 1247415
658514 1163216
584903 1829579
3...

output:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 ...

result:

ok 199999 numbers

Test #108:

score: 29
Accepted
time: 979ms
memory: 107424kb

input:

200000 200000
52274 130656
91938 187848
146519 187513
2775 30215
119453 144745
188029 115046
167165 196661
190442 78787
143923 176153
2306 151544
177848 43243
179425 7091
54855 128487
84645 175845
9072 8701
128557 169685
193752 171369
163409 140825
175395 71058
167744 83599
191198 119401
164252 4266...

output:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 ...

result:

ok 199993 numbers

Test #109:

score: 29
Accepted
time: 731ms
memory: 105172kb

input:

200000 200000
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
17 17
18 18
19 19
20 20
21 21
22 22
23 23
24 24
25 25
26 26
27 27
28 28
29 29
30 30
31 31
32 32
33 33
34 34
35 35
36 36
37 37
38 38
39 39
40 40
41 41
42 42
43 43
44 44
45 45
46 46
47 47
48 48
49 49
50 50
51 5...

output:

1 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 94 96 98 100 102 104 106 108 110 112 114 116 118 120 122 124 126 128 130 132 134 136 138 140 142 144 146 148 150 152 154 156 158 160 162 164 166 168 170 172 174 176...

result:

ok 100002 numbers

Test #110:

score: 29
Accepted
time: 1044ms
memory: 110448kb

input:

200000 200000
1 200000
2 199999
3 199998
4 199997
5 199996
6 199995
7 199994
8 199993
9 199992
10 199991
11 199990
12 199989
13 199988
14 199987
15 199986
16 199985
17 199984
18 199983
19 199982
20 199981
21 199980
22 199979
23 199978
24 199977
25 199976
26 199975
27 199974
28 199973
29 199972
30 19...

output:

1 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 ...

result:

ok 199995 numbers

Test #111:

score: 29
Accepted
time: 956ms
memory: 117080kb

input:

200000 200000
434204577 826171418
272164104 917481693
791562169 742941136
388660847 151313562
272164104 917481693
278420421 52122694
278420421 52122694
278420421 52122694
226356987 97907429
278420421 52122694
43804246 725382830
43804246 725382830
278420421 52122694
43804246 725382830
403672705 40167...

output:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 ...

result:

ok 200000 numbers

Test #112:

score: 29
Accepted
time: 463ms
memory: 92080kb

input:

200000 200000
21 732
391 576
386 772
359 487
183 504
195 760
375 688
121 755
20 811
196 880
80 479
267 697
430 837
256 848
66 687
33 492
334 529
323 697
263 806
66 749
123 877
337 867
436 551
327 474
26 464
241 748
294 789
182 585
60 759
208 733
75 565
441 771
207 501
246 564
304 601
223 707
130 514...

output:

2 4 6 9 10 11 12 15 16 18 19 20 22 23 25 28 31 34 36 37 38 42 43 47 49 52 53 55 56 62 67 68 70 71 72 76 77 79 80 85 88 93 95 97 98 99 100 101 102 103 105 106 107 109 112 117 118 120 122 123 126 127 130 131 137 138 139 141 143 144 146 148 149 150 153 154 156 163 164 165 166 167 168 169 170 175 176 18...

result:

ok 50116 numbers

Test #113:

score: 29
Accepted
time: 474ms
memory: 92060kb

input:

200000 200000
866 327
656 41
748 88
756 289
700 112
652 352
797 196
801 63
730 37
492 380
562 18
521 188
526 109
804 260
618 105
778 235
526 52
832 167
895 342
471 364
733 119
892 225
829 252
890 392
518 52
767 86
722 113
733 144
758 396
527 348
524 166
884 295
528 259
864 373
476 317
714 49
699 196...

output:

3 7 8 14 17 20 22 23 24 25 28 30 33 34 35 36 41 42 43 45 47 50 51 56 57 59 61 62 63 65 67 68 74 75 78 80 81 85 86 89 91 92 94 97 100 102 105 106 107 109 111 113 116 118 119 122 123 124 129 132 137 140 142 143 144 147 148 150 152 155 156 158 159 163 165 166 167 168 169 171 172 174 175 176 182 185 186...

result:

ok 50508 numbers

Test #114:

score: 29
Accepted
time: 465ms
memory: 93072kb

input:

200000 200000
383 821
385 646
301 533
67 461
216 538
138 885
416 780
298 677
59 616
89 783
352 603
299 883
283 737
19 653
130 547
193 734
445 719
403 678
71 552
319 566
391 569
21 864
61 836
416 842
30 830
47 480
204 698
395 741
74 610
43 514
448 767
15 704
45 576
99 461
187 659
378 569
306 715
176 ...

output:

3 4 8 10 15 20 21 22 23 25 26 29 31 34 35 36 38 39 41 42 43 44 47 48 52 53 54 55 57 58 59 61 66 69 72 73 76 77 80 82 83 84 85 86 87 88 89 92 94 96 97 98 100 101 102 103 104 106 108 109 112 115 117 121 122 123 125 128 129 131 132 134 136 137 139 140 142 143 144 145 146 151 152 154 159 161 163 164 165...

result:

ok 50503 numbers

Test #115:

score: 29
Accepted
time: 464ms
memory: 92384kb

input:

200000 200000
768 362
802 32
467 174
624 297
899 179
752 61
787 436
877 422
455 85
895 445
754 107
722 283
784 20
566 385
817 202
585 403
693 85
683 34
695 123
696 370
859 353
629 341
515 16
603 41
665 152
742 432
857 304
893 450
847 65
749 451
688 324
675 436
538 442
627 368
743 364
463 323
832 101...

output:

3 4 8 9 10 11 12 14 15 22 26 28 30 31 32 33 34 35 41 43 44 45 47 50 51 54 55 57 59 61 62 63 64 68 70 72 73 75 76 79 80 81 85 87 88 91 94 96 98 99 100 101 102 104 105 111 113 115 116 117 118 119 122 123 124 125 127 129 131 132 133 137 138 140 144 145 150 152 153 155 156 157 158 163 165 166 167 168 16...

result:

ok 50419 numbers

Test #116:

score: 29
Accepted
time: 467ms
memory: 92320kb

input:

200000 200000
460 188
515 292
699 199
892 26
564 115
571 234
639 249
582 57
564 40
455 13
765 264
749 141
879 301
769 23
808 372
461 418
630 221
534 61
626 240
713 398
673 155
488 67
887 43
786 158
682 21
887 31
681 267
780 82
820 322
885 21
864 159
479 140
478 257
686 229
880 427
493 351
874 276
88...

output:

6 10 11 12 14 15 16 17 18 19 21 33 35 36 38 39 40 41 43 44 45 46 49 50 51 52 53 54 57 58 62 63 65 66 67 68 70 72 73 75 80 81 82 84 85 87 88 92 95 96 97 98 100 102 103 104 105 107 113 114 118 123 124 126 128 129 131 135 137 138 140 142 143 144 146 147 148 149 150 151 152 156 158 159 160 162 164 165 1...

result:

ok 50163 numbers

Test #117:

score: 29
Accepted
time: 464ms
memory: 93012kb

input:

200000 200000
410 823
12 800
38 816
125 681
257 689
101 637
379 739
20 596
185 544
11 485
16 797
260 576
29 587
306 879
391 596
42 664
313 540
352 726
125 634
192 615
48 515
273 513
23 875
166 835
151 616
369 847
42 640
373 539
376 663
276 815
39 777
342 889
197 497
21 473
391 580
315 459
272 569
23...

output:

4 7 8 10 12 13 15 20 23 24 27 28 29 34 35 37 38 39 40 41 43 44 47 49 50 51 52 54 55 56 58 59 60 62 66 67 68 69 70 72 76 78 82 83 85 86 88 89 90 91 92 93 97 102 103 104 106 107 111 113 114 115 118 119 120 121 127 133 137 138 140 146 151 152 156 158 160 164 168 170 174 175 177 178 179 182 186 187 191 ...

result:

ok 50330 numbers

Test #118:

score: 29
Accepted
time: 468ms
memory: 94208kb

input:

200000 200000
452 451
91 849
325 594
404 599
338 698
233 572
175 759
73 529
426 741
190 893
129 492
128 493
375 716
126 770
247 503
446 533
47 481
216 772
387 475
321 569
341 604
413 819
117 898
12 460
135 505
84 555
85 472
257 864
22 794
140 767
234 849
382 883
162 820
305 739
379 668
133 808
225 7...

output:

1 3 4 5 6 7 11 15 16 18 21 22 23 26 29 33 36 37 39 41 43 45 46 47 49 50 52 53 55 58 59 65 72 73 74 76 78 80 81 82 86 92 93 96 97 98 101 102 104 107 109 111 114 115 120 121 126 127 129 135 136 137 138 139 145 147 149 150 153 154 155 157 158 160 161 164 165 168 169 172 173 178 179 180 182 183 185 186 ...

result:

ok 50594 numbers

Test #119:

score: 29
Accepted
time: 444ms
memory: 92864kb

input:

200000 200000
453 452
716 351
498 242
798 213
857 283
612 434
514 306
574 356
573 210
879 294
837 167
845 419
594 288
552 116
524 395
502 267
623 257
794 118
764 57
803 145
837 26
587 58
509 78
876 211
479 315
590 352
747 162
536 168
862 227
638 415
809 168
817 231
868 173
491 342
524 35
882 375
883...

output:

1 2 5 6 7 10 13 14 15 18 23 24 25 26 30 34 35 36 38 40 42 43 45 49 53 56 58 61 62 65 67 70 71 75 76 79 83 84 86 88 90 91 92 94 95 98 101 102 105 106 107 108 109 110 111 113 114 118 126 127 129 130 131 132 134 135 136 137 138 139 140 142 151 152 155 156 158 162 165 166 168 170 171 172 175 178 181 182...

result:

ok 50171 numbers

Test #120:

score: 29
Accepted
time: 1138ms
memory: 114072kb

input:

200000 200000
590 356
623 332
512 286
653 361
829 205
585 418
740 45
824 354
862 7
560 360
741 256
660 179
719 86
876 120
806 238
711 433
883 233
593 368
743 251
626 320
526 119
530 238
473 12
717 76
666 292
878 55
809 412
806 159
515 277
862 385
796 329
800 221
485 18
722 325
473 270
705 412
464 63...

output:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 ...

result:

ok 200000 numbers

Extra Test:

score: 0
Extra Test Passed