QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#582796#9170. Cycle Gameucup-team4435#AC ✓118ms12676kbC++208.2kb2024-09-22 17:28:202024-09-22 17:28:22

Judging History

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

  • [2024-09-22 17:28:22]
  • 评测
  • 测评结果:AC
  • 用时:118ms
  • 内存:12676kb
  • [2024-09-22 17:28:20]
  • 提交

answer

// Copyright (C) 2003-2024 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library.  This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.

// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.

// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
// <http://www.gnu.org/licenses/>.

/** @file stdc++.h
 *  This is an implementation file for a precompiled header.
 */

// 17.4.1.2 Headers

// C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <csetjmp>
#include <cstdarg>
#include <cstddef>
#include <cstdlib>

#if __cplusplus >= 201103L
#include <cstdint>
#endif

// C++
#include <bitset>
#include <complex>
#include <algorithm>
#include <bitset>
#include <functional>
#include <iterator>
#include <limits>
#include <memory>
#include <new>
#include <numeric>
#include <typeinfo>
#include <utility>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <initializer_list>
#include <ratio>
#include <scoped_allocator>
#include <tuple>
#include <typeindex>
#include <type_traits>
#endif

#if __cplusplus >= 201402L
#endif

#if __cplusplus >= 201703L
#include <any>
// #include <execution>
#include <optional>
#include <variant>
#include <string_view>
#endif

#if __cplusplus >= 202002L
#include <bit>
#include <compare>
#include <concepts>
#include <numbers>
#include <ranges>
#include <span>
#include <source_location>
#include <version>
#endif

#if __cplusplus > 202002L
#include <expected>
#include <stdatomic.h>
#if __cpp_impl_coroutine
# include <coroutine>
#endif
#endif

// C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cwchar>
#include <cwctype>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cuchar>
#endif

// C++
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <codecvt>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

#if __cplusplus >= 201402L
#include <shared_mutex>
#endif

#if __cplusplus >= 201703L
#include <any>
#include <charconv>
// #include <execution>
#include <filesystem>
#include <optional>
#include <memory_resource>
#include <variant>
#endif

#if __cplusplus >= 202002L
#include <barrier>
#include <bit>
#include <compare>
#include <concepts>
#include <format>
#include <latch>
#include <numbers>
#include <ranges>
#include <span>
#include <stop_token>
#include <semaphore>
#include <source_location>
#include <syncstream>
#include <version>
#endif

#if __cplusplus > 202002L
#include <expected>
#include <generator>
#include <print>
#include <spanstream>
#if __has_include(<stacktrace>)
# include <stacktrace>
#endif
#include <stdatomic.h>
#include <stdfloat>
#endif

#if __cplusplus > 202302L
#include <text_encoding>
#endif

namespace std {
    template<typename T>
    int __lg(T x) {
        assert(x > 0);
        int ans = 0;
        while (x > 0) {
            ans += 1;
            x >>= 1;
        }
        return ans - 1;
    }
}

using namespace std;
using ll = long long;

struct DSU {
    vector<int> p, sz;
    vector<pair<int, int>> stk;
    int n{};
    int e = 0, t = 0;

    DSU() = default;

    DSU(int n) : n(n), p(n), sz(n, 1) {
        iota(p.begin(), p.end(), 0);
        stk.clear();
    }

    int leader(int a) {
        return p[a] == a ? a : leader(p[a]);
    }

    bool unite(int a, int b) {
        a = leader(a), b = leader(b);
        if (a == b) {
            return false;
        }
        t += 1;
        if (sz[a] < sz[b]) {
            swap(a, b);
        }
        sz[a] += sz[b];
        p[b] = a;
        stk.back() = {a, b};
        return true;
    }

    bool same(int a, int b) {
        return leader(a) == leader(b);
    }

    void undo() {
        e -= 1;
        assert(!stk.empty());
        auto [a, b] = stk.back();
        stk.pop_back();
        if (a != -1) {
            p[b] = b;
            t -= 1;
            sz[a] -= sz[b];
        }
    }

    void update(pair<int, int> a) {
        e += 1;
        stk.emplace_back(-1, -1);
        unite(a.first, a.second);
    }
};

void solve() {
    int n, m, k;
    cin >> n >> m >> k;

    int cnt22 = 0, cnt33 = 0;
    vector<int> here(n * m);
    DSU d(n * m);
    auto check = [&](int x, int y) {
        if (x >= 0 && y >= 0 && x < n - 1 && y < m - 1) {
            return here[x * m + y] && here[x * m + y + 1] && here[x * m + m + y] && here[x * m + m + y + 1];
        } else {
            return false;
        }
    };
    auto check33 = [&](int x, int y) {
        return check(x, y) && check(x + 1, y) && check(x, y + 1) && check(x + 1, y + 1);
    };
    auto count = [&](int x, int y) {
        return check(x - 1, y - 1) + check(x, y) + check(x - 1, y) + check(x, y - 1);
    };
    auto count33 = [&](int x, int y) {
        int r = 0;
        for (int u = -2; u <= 0; ++u) {
            for (int f = -2; f <= 0; ++f) {
                r += check33(x + u, y + f);
            }
        }
        return r;
    };
    int dx[]{0, 0, 1, -1}, dy[]{1, -1, 0, 0};
    auto toggle = [&](int x, int y) {
        cnt22 -= count(x, y);
        cnt33 -= count33(x, y);
        int id = x * m + y;
        here[id] ^= 1;
        for (int t = 0; t < 4; ++t) {
            int nx = x + dx[t], ny = y + dy[t];
            if (nx >= 0 && nx < n && ny >= 0 && ny < m && here[nx * m + ny]) {
                if (here[id]) {
                    d.update({id, nx * m + ny});
                } else {
                    d.undo();
                }
            }
        }
        cnt22 += count(x, y);
        cnt33 += count33(x, y);
    };
    auto isGood = [&]() {
        return d.e == cnt22 + d.t && cnt33 == 0;
    };
    while (k--) {
        int x, y;
        cin >> x >> y;
        --x, --y;
        toggle(x, y);
        if (isGood()) {
            cout << "1";
        } else {
            toggle(x, y);
            cout << "0";
        }
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int test = 1;
//    cin >> test;

    while (test--) {
        solve();
    }

    return 0;
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

4 3 7
2 1
2 2
2 3
3 1
3 2
4 1
4 2

output:

1111111

result:

ok "1111111"

Test #2:

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

input:

3 3 8
1 1
1 2
1 3
2 3
3 3
3 2
3 1
2 1

output:

11111110

result:

ok "11111110"

Test #3:

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

input:

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

output:

1111111

result:

ok "1111111"

Test #4:

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

input:

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

output:

11111111111111111111111111111111111111111111111111

result:

ok "11111111111111111111111111111111111111111111111111"

Test #5:

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

input:

3 5 11
1 5
2 4
1 2
1 3
3 3
3 1
3 4
2 3
1 4
2 1
2 5

output:

11111111111

result:

ok "11111111111"

Test #6:

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

input:

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

output:

111111111111

result:

ok "111111111111"

Test #7:

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

input:

1 4 1
1 2

output:

1

result:

ok "1"

Test #8:

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

input:

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

output:

1111111111111111111111111111111111111111111110010101101000101101101

result:

ok "111111111111111111111111111111...1111111110010101101000101101101"

Test #9:

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

input:

3 10 3
3 9
2 5
2 7

output:

111

result:

ok "111"

Test #10:

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

input:

222212 1 21562
105762 1
167947 1
127551 1
117618 1
174844 1
139867 1
156729 1
30554 1
54488 1
151832 1
132914 1
109432 1
212091 1
136499 1
17818 1
48806 1
95752 1
66607 1
39930 1
23054 1
160823 1
169054 1
96680 1
150677 1
52895 1
93103 1
118079 1
79155 1
194811 1
141874 1
138763 1
2600 1
121471 1
17...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok "111111111111111111111111111111...1111111111111111111111111111111"

Test #11:

score: 0
Accepted
time: 23ms
memory: 6180kb

input:

1 167058 126088
1 15282
1 63796
1 77270
1 88793
1 42787
1 129851
1 34468
1 74525
1 121105
1 157182
1 92736
1 102044
1 11284
1 23439
1 142720
1 128610
1 27437
1 105575
1 130827
1 152824
1 76358
1 152954
1 65509
1 139802
1 66299
1 108943
1 140446
1 112411
1 95814
1 115750
1 9667
1 55383
1 89323
1 6734...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok "111111111111111111111111111111...1111111111111111111111111111111"

Test #12:

score: 0
Accepted
time: 26ms
memory: 5592kb

input:

9 12788 86384
4 11931
2 8183
1 5816
7 10320
8 5754
4 10778
4 12280
7 12746
1 4699
3 7876
4 3044
2 4903
9 10252
8 10512
7 6546
8 1338
5 9700
1 9833
6 11315
2 4067
7 9350
9 8200
2 1718
1 2542
2 4596
9 367
5 12426
1 12166
5 7652
4 2316
9 1946
3 6187
4 3306
1 63
8 4132
3 12491
2 3951
8 4169
7 11801
9 46...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok "111111111111111111111111111111...0010111100011000000100110101100"

Test #13:

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

input:

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

output:

1111111111111111111111111111111101111111111011011001000000

result:

ok "1111111111111111111111111111111101111111111011011001000000"

Test #14:

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

input:

23660 2 4698
10158 1
1229 1
51 2
10559 2
15495 2
19343 1
18458 1
19633 2
23151 1
11738 2
21366 1
12968 2
10474 1
10552 2
8067 2
7125 2
14643 1
7579 2
21608 2
7067 2
20400 1
14397 2
21474 2
8294 2
1332 1
18105 1
2285 1
1223 1
13429 2
18580 2
11156 2
5498 1
6830 1
8848 2
21334 2
11946 1
10177 1
5349 1...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok "111111111111111111111111111111...1111111111111111111111111111111"

Test #15:

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

input:

51 732 29706
14 458
6 600
18 452
43 262
24 685
51 192
14 248
50 672
16 65
45 191
25 196
1 447
4 574
32 493
16 100
39 715
17 397
37 644
32 580
32 622
22 160
20 694
29 120
30 302
7 283
18 290
51 420
20 553
42 681
11 724
26 528
50 497
46 500
3 534
36 58
42 167
18 534
1 654
50 276
37 386
19 649
14 41
8 ...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok "111111111111111111111111111111...0100001111101110110110000010000"

Test #16:

score: 0
Accepted
time: 65ms
memory: 8920kb

input:

75000 4 225000
71753 3
13211 2
61737 3
59039 3
3674 3
50461 4
12758 3
69966 1
57525 1
42178 1
15054 1
66939 2
2798 4
74983 2
7250 2
2247 4
11438 1
67858 4
66527 2
21625 2
14111 2
28737 1
7431 4
11317 3
47421 2
51295 4
39591 4
20811 3
51582 3
47874 2
3238 2
10987 3
1225 1
58741 4
2141 3
35454 4
5021 ...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok "111111111111111111111111111111...1101011111100100010101000000000"

Test #17:

score: 0
Accepted
time: 67ms
memory: 11612kb

input:

100000 3 240000
63826 2
25561 1
24122 3
56762 3
66822 2
24467 2
5419 1
59533 2
71406 2
62274 1
63084 1
33262 3
16614 2
71724 1
99182 1
3574 3
2804 2
40022 2
90379 1
44898 2
59169 3
55663 1
79971 2
30606 3
58613 3
38992 3
51702 1
10168 3
44411 3
39048 1
25384 2
276 1
68607 1
34137 1
72641 2
92427 1
9...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok "111111111111111111111111111111...0101001000001000101001011110010"

Test #18:

score: 0
Accepted
time: 89ms
memory: 12676kb

input:

60000 5 250000
19905 3
6687 2
7727 4
23854 3
1329 4
45419 4
15116 1
35612 4
11560 1
16969 5
43328 4
30175 2
1587 5
15890 1
53896 3
43465 4
26642 2
3443 5
6697 5
6489 3
44351 2
48037 2
39926 5
974 1
20783 2
51437 4
31394 2
33663 2
26261 5
49301 4
2074 1
16999 4
48098 5
28754 4
27961 3
614 5
57608 2
5...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok "111111111111111111111111111111...0010100101111000100000011001011"

Test #19:

score: 0
Accepted
time: 71ms
memory: 11856kb

input:

100000 3 270000
50999 2
78476 3
21423 1
26134 3
69234 1
48259 3
40043 1
92586 1
96544 3
65679 1
63139 1
79464 2
76129 3
3836 3
65093 1
81997 3
13905 2
82341 2
32201 1
42796 2
69216 3
14753 3
50176 3
66724 2
21607 3
9619 2
96579 1
59856 2
5086 1
89747 1
4122 3
8806 3
57529 2
6476 3
6689 2
97261 1
936...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok "111111111111111111111111111111...0000011010000000010100010001010"

Test #20:

score: 0
Accepted
time: 115ms
memory: 11932kb

input:

29997 10 272700
22251 10
4359 10
3780 4
23168 10
19310 8
784 2
21855 1
19914 4
279 9
26868 6
11534 3
17252 8
10865 2
15782 3
10134 4
17047 4
8318 5
11552 4
21333 1
2023 10
17397 5
13151 3
21068 3
1171 3
21112 4
23374 4
289 8
9248 3
19337 3
10005 7
16909 2
14103 5
3098 8
23534 3
7782 1
4765 7
10294 8...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok "111111111111111111111111111111...1100000010000000010000000100010"

Test #21:

score: 0
Accepted
time: 26ms
memory: 8976kb

input:

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

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok "111111111111111111111111111111...1111110111111101111111011111111"

Test #22:

score: 0
Accepted
time: 36ms
memory: 8828kb

input:

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

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok "111111111111111111111111111111...0000000000000000000000000000001"

Test #23:

score: 0
Accepted
time: 21ms
memory: 8852kb

input:

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

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok "111111111111111111111111111111...1111111111111111111111111111111"

Test #24:

score: 0
Accepted
time: 118ms
memory: 11568kb

input:

1000 300 300000
1 1
1 3
1 5
1 7
1 9
1 11
1 13
1 15
1 17
1 19
1 21
1 23
1 25
1 27
1 29
1 31
1 33
1 35
1 37
1 39
1 41
1 43
1 45
1 47
1 49
1 51
1 53
1 55
1 57
1 59
1 61
1 63
1 65
1 67
1 69
1 71
1 73
1 75
1 77
1 79
1 81
1 83
1 85
1 87
1 89
1 91
1 93
1 95
1 97
1 99
1 101
1 103
1 105
1 107
1 109
1 111
1 1...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok "111111111111111111111111111111...0000001001001100100000110100001"

Test #25:

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

input:

30000 10 300000
1 1
1 3
1 5
1 7
1 9
3 1
3 3
3 5
3 7
3 9
5 1
5 3
5 5
5 7
5 9
7 1
7 3
7 5
7 7
7 9
9 1
9 3
9 5
9 7
9 9
11 1
11 3
11 5
11 7
11 9
13 1
13 3
13 5
13 7
13 9
15 1
15 3
15 5
15 7
15 9
17 1
17 3
17 5
17 7
17 9
19 1
19 3
19 5
19 7
19 9
21 1
21 3
21 5
21 7
21 9
23 1
23 3
23 5
23 7
23 9
25 1
25 3...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok "111111111111111111111111111111...0001000000000000100000000010000"

Extra Test:

score: 0
Extra Test Passed