QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#302837#7977. 彩虹航线hos_lyric#61 794ms82148kbC++145.5kb2024-01-11 13:59:382024-07-04 03:17:41

Judging History

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

  • [2024-07-04 03:17:41]
  • 评测
  • 测评结果:61
  • 用时:794ms
  • 内存:82148kb
  • [2024-01-11 13:59:38]
  • 提交

answer

#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

using Int = long long;

template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { return os << "(" << a.first << ", " << a.second << ")"; };
template <class T> ostream &operator<<(ostream &os, const vector<T> &as) { const int sz = as.size(); os << "["; for (int i = 0; i < sz; ++i) { if (i >= 256) { os << ", ..."; break; } if (i > 0) { os << ", "; } os << as[i]; } return os << "]"; }
template <class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << " "; cerr << endl; }
template <class T> bool chmin(T &t, const T &f) { if (t > f) { t = f; return true; } return false; }
template <class T> bool chmax(T &t, const T &f) { if (t < f) { t = f; return true; } return false; }
#define COLOR(s) ("\x1b[" s "m")


#include <chrono>

#ifdef LOCAL
mt19937_64 rng(58);
#else
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
#endif


namespace bm {
constexpr int LIM_N0 = 210;
constexpr int LIM_N1 = 210;
constexpr int LIM_M = 40010;
int n0, n1, m, as[LIM_M], bs[LIM_M];
int to[LIM_N0], fr[LIM_N1], tof;
int pt[LIM_N0 + 2], zu[LIM_M], used[LIM_N0], lev[LIM_N0], que[LIM_N0], *qb, *qe;
void init(int n0_, int n1_) {
  n0 = n0_; n1 = n1_; m = 0;
}
int ae(int u, int v) {
  as[m] = u; bs[m] = v; return m++;
}
int augment(int u) {
  used[u] = tof;
  for (int j = pt[u]; j < pt[u + 1]; ++j) {
    const int v = zu[j];
    const int w = fr[v];
    if (!~w || (used[w] != tof && lev[u] < lev[w] && augment(w))) {
      to[u] = v; fr[v] = u; return 1;
    }
  }
  return 0;
}
int run() {
  memset(pt, 0, (n0 + 2) * sizeof(int));
  for (int i = 0; i < m; ++i) ++pt[as[i] + 2];
  for (int u = 2; u <= n0; ++u) pt[u + 1] += pt[u];
  for (int i = 0; i < m; ++i) zu[pt[as[i] + 1]++] = bs[i];
  memset(to, ~0, n0 * sizeof(int));
  memset(fr, ~0, n1 * sizeof(int));
  memset(used, ~0, n0 * sizeof(int));
  for (tof = 0; ; ) {
    qb = qe = que; memset(lev, ~0, n0 * sizeof(int));
    for (int u = 0; u < n0; ++u) if (!~to[u]) lev[*qe++ = u] = 0;
    for (; qb != qe; ) {
      const int u = *qb++;
      for (int j = pt[u]; j < pt[u + 1]; ++j) {
        const int w = fr[zu[j]];
        if (~w && !~lev[w]) lev[*qe++ = w] = lev[u] + 1;
      }
    }
    int f = 0;
    for (int u = 0; u < n0; ++u) if (!~to[u]) f += augment(u);
    if (!f) return tof;
    tof += f;
  }
}

// s: true, t: false (s: reachable from unmatched left)
// vertex cover: (0: false, 0: true)
// independent set: (0: true, 1: false)
bool side0[LIM_N0], side1[LIM_N1];
void dfs(int u) {
  if (!side0[u]) {
    side0[u] = true;
    for (int j = pt[u]; j < pt[u + 1]; ++j) {
      const int v = zu[j];
      if (!side1[v]) {
        side1[v] = true;
        const int w = fr[v];
        if (~w) dfs(w);
      }
    }
  }
}
void minCut() {
  memset(side0, 0, n0 * sizeof(bool));
  memset(side1, 0, n1 * sizeof(bool));
  for (int u = 0; u < n0; ++u) if (!~to[u]) dfs(u);
}
}  // namespace bm


int N, M, K;
vector<int> A, B;
vector<vector<int>> C;

int main() {
  for (; ~scanf("%d%d%d", &N, &M, &K); ) {
    A.resize(M);
    B.resize(M);
    C.assign(M, vector<int>(K));
    for (int i = 0; i < M; ++i) {
      scanf("%d%d", &A[i], &B[i]);
      --A[i];
      --B[i];
      for (int k = 0; k < K; ++k) {
        scanf("%d", &C[i][k]);
      }
    }
    
    int limC = 0;
    for (int i = 0; i < M; ++i) {
      for (int k = 0; k < K; ++k) {
        chmax(limC, C[i][k]);
      }
    }
    ++limC;
    vector<vector<int>> iss(limC);
    for (int i = 0; i < M; ++i) {
      for (int k = 0; k < K; ++k) {
        iss[C[i][k]].push_back(i);
      }
    }
    vector<int> cs(limC);
    for (int c = 0; c < limC; ++c) cs[c] = c;
    shuffle(cs.begin(), cs.end(), rng);
    sort(cs.begin(), cs.end(), [&](int c0, int c1) -> bool {
      return (iss[c0].size() > iss[c1].size());
    });
    
    vector<int> ans(M, -1);
    vector<int> idsA(N, -1), idsB(N, -1);
    for (const int c : cs) {
      vector<int> is;
      for (const int i : iss[c]) if (!~ans[i]) {
        is.push_back(i);
      }
      if (is.size()) {
        vector<int> as, bs;
        for (const int i : is) {
          as.push_back(A[i]);
          bs.push_back(B[i]);
        }
        sort(as.begin(), as.end());
        sort(bs.begin(), bs.end());
        as.erase(unique(as.begin(), as.end()), as.end());
        bs.erase(unique(bs.begin(), bs.end()), bs.end());
        const int asLen = as.size();
        const int bsLen = bs.size();
        for (int x = 0; x < asLen; ++x) idsA[as[x]] = x;
        for (int y = 0; y < bsLen; ++y) idsB[bs[y]] = y;
        bm::init(asLen, bsLen);
        for (const int i : is) {
          bm::ae(idsA[A[i]], idsB[B[i]]);
        }
        bm::run();
        for (const int i : is) {
          if (bm::to[idsA[A[i]]] == idsB[B[i]]) {
            ans[i] = c;
          }
        }
      }
    }
    
    for (int i = 0; i < M; ++i) {
      if (i) printf(" ");
      printf("%d", ans[i]);
    }
    puts("");
  }
  return 0;
}

详细

Subtask #1:

score: 1
Accepted

Test #1:

score: 1
Accepted
time: 1ms
memory: 3840kb

input:

150 150 1
144 5 1
141 54 1
26 120 1
148 68 1
136 62 1
114 1 1
33 136 1
85 100 1
97 124 1
84 66 1
107 81 1
82 135 1
112 44 1
20 89 1
50 32 1
52 94 1
89 88 1
3 57 1
130 23 1
140 150 1
96 37 1
122 38 1
41 63 1
99 85 1
13 95 1
142 47 1
95 4 1
69 17 1
27 119 1
73 93 1
108 43 1
54 18 1
37 76 1
67 114 1
40...

output:

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

result:

ok construction is correct.

Test #2:

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

input:

150 150 1
117 132 96
147 4 114
67 57 60
62 94 20
48 117 68
31 144 27
19 44 121
3 51 92
83 52 67
26 125 56
8 124 75
125 31 52
79 8 21
132 14 136
77 111 45
134 136 145
129 73 85
122 92 143
59 76 36
60 127 115
102 126 133
10 106 32
93 35 106
75 47 102
45 140 41
44 108 146
25 98 106
140 116 76
143 3 87
...

output:

96 114 60 20 68 27 121 92 67 56 75 52 21 136 45 145 85 143 36 115 133 32 106 102 41 146 106 76 87 90 116 15 147 51 35 85 15 83 43 105 89 12 89 140 103 114 135 78 93 80 87 93 19 7 125 132 96 96 99 48 1 63 3 6 146 116 48 9 126 6 106 64 74 84 16 23 119 51 7 83 96 56 94 97 27 15 51 106 95 32 70 103 75 8...

result:

ok construction is correct.

Test #3:

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

input:

150 10 1
35 145 1
145 88 2
130 14 1
111 142 1
138 99 1
76 73 1
101 79 1
147 137 2
65 64 1
108 8 2

output:

1 2 1 1 1 1 1 2 1 2

result:

ok construction is correct.

Subtask #2:

score: 2
Accepted

Test #4:

score: 2
Accepted
time: 272ms
memory: 46736kb

input:

75 5625 150
11 6 680849 150419 731361 419631 223710 806977 837589 529911 568337 456216 515190 302854 672904 388629 548276 803173 770491 610684 550790 786097 253610 446581 705772 610053 637171 567249 365794 571846 431219 213414 466432 53255 748825 765338 761154 556712 159152 463622 706471 49434 59624...

output:

273492 589359 133317 328142 662071 62722 724388 684378 684378 200061 817785 157706 89268 195276 289550 538589 687833 219768 473001 48009 207468 691549 293935 365231 718783 417391 136898 118053 339927 812720 728368 93324 217910 833004 102359 27191 506861 646926 516499 788116 763852 698766 723551 6100...

result:

ok construction is correct.

Test #5:

score: 0
Accepted
time: 54ms
memory: 12616kb

input:

75 5625 150
55 59 136 110 80 141 34 72 121 2 116 38 39 16 56 20 147 81 58 64 24 83 73 30 127 97 128 35 77 96 54 21 106 57 32 115 133 84 50 103 94 45 68 53 31 8 55 44 89 41 36 150 3 28 9 98 66 49 119 101 114 112 82 11 22 124 134 107 105 90 88 145 87 135 26 79 37 122 10 15 104 27 18 120 7 13 46 139 40...

output:

75 6 141 86 128 122 141 141 141 128 141 141 141 141 100 80 141 93 128 141 141 100 100 75 93 141 75 141 100 128 141 141 100 141 141 100 141 141 141 100 73 141 24 100 141 141 93 141 73 128 100 137 73 80 141 100 141 141 141 141 100 128 100 100 128 87 75 75 75 75 63 141 75 141 75 93 100 127 73 128 86 10...

result:

ok construction is correct.

Test #6:

score: 0
Accepted
time: 148ms
memory: 32344kb

input:

75 3750 150
1 29 15545 372923 77579 125076 509966 151564 332286 414939 296369 227609 9580 52174 99587 224186 2679 309545 38096 115252 281893 44718 259941 187595 500086 197842 267668 399469 254416 114691 268905 112134 257669 210411 135373 423915 537194 17707 204354 99757 234452 307155 82087 64190 309...

output:

296369 160117 433697 415006 35088 211280 44715 232302 101919 554227 81138 76454 376051 196815 489706 489706 197447 506579 384294 75004 43677 489718 490246 316152 307511 178241 321339 197779 105341 114871 258375 221149 115201 490957 418981 57467 437567 424008 95189 230250 306592 260359 156886 444732 ...

result:

ok construction is correct.

Test #7:

score: 0
Accepted
time: 34ms
memory: 8748kb

input:

75 3750 150
43 71 86 127 132 6 139 123 83 37 85 103 52 102 4 148 111 34 110 66 42 130 150 149 53 45 137 129 2 5 87 79 146 47 9 98 96 54 17 126 81 115 7 105 117 119 101 144 74 23 44 19 84 97 50 13 22 94 78 63 134 40 142 76 109 95 12 138 112 72 136 24 77 31 32 118 124 135 68 104 16 1 93 106 128 51 20 ...

output:

17 82 141 17 82 30 82 43 48 110 82 82 143 48 110 82 82 9 82 61 82 82 17 82 143 82 82 82 82 82 43 141 143 82 82 141 143 82 110 82 143 62 82 110 82 43 82 143 143 17 17 82 82 141 125 43 48 143 125 82 125 137 143 82 143 40 62 143 9 82 82 82 17 141 17 143 143 17 43 48 17 141 82 125 48 143 40 125 143 82 1...

result:

ok construction is correct.

Subtask #3:

score: 0
Wrong Answer

Test #8:

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

input:

150 300 2
81 6 1 2
64 88 1 2
5 76 2 1
22 9 2 1
32 142 1 2
97 32 2 1
18 87 1 2
146 100 2 1
56 139 1 2
61 109 2 1
124 105 2 1
126 145 1 2
16 19 1 2
16 138 2 1
131 111 2 1
145 111 2 1
59 59 2 1
89 43 1 2
2 38 1 2
63 149 2 1
46 48 1 2
140 131 1 2
86 10 2 1
116 40 1 2
123 38 2 1
75 109 2 1
131 142 1 2
9 ...

output:

1 1 1 1 1 2 1 1 2 1 2 2 2 1 1 2 2 1 1 2 2 2 2 1 2 2 2 2 1 2 2 1 1 1 1 1 2 2 1 2 2 1 2 2 1 1 2 1 1 1 1 2 2 2 2 2 1 2 1 1 1 2 1 2 2 1 2 2 1 2 2 2 2 1 1 1 2 1 2 1 1 2 1 2 1 2 2 2 1 2 2 2 2 1 1 2 1 2 2 2 1 2 1 2 1 1 1 2 1 1 1 1 1 2 1 2 2 1 2 1 2 2 1 1 2 1 2 1 2 2 1 1 1 1 1 1 2 2 1 2 1 1 1 1 1 2 1 2 1 1 ...

result:

ok construction is correct.

Test #9:

score: -11
Wrong Answer
time: 1ms
memory: 4144kb

input:

150 300 2
60 122 3 1
114 17 2 1
21 19 3 1
134 75 3 1
64 81 2 1
52 33 1 3
45 27 1 2
148 91 2 1
110 100 1 2
100 74 2 3
53 130 3 2
59 19 3 1
149 108 3 1
19 92 1 3
85 66 3 2
80 89 3 2
16 4 2 3
39 90 2 3
53 102 3 1
20 21 3 1
21 112 1 3
76 98 1 2
7 130 3 1
140 129 2 3
139 100 3 1
127 77 1 3
136 113 3 2
54...

output:

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

result:

wrong answer Integer -1 violates the range [1, 600]

Subtask #4:

score: 37
Accepted

Test #18:

score: 37
Accepted
time: 298ms
memory: 35800kb

input:

149 22201 150
106 24 20 90 56 109 85 33 76 25 97 77 134 75 15 24 88 16 93 126 43 94 116 120 28 130 21 140 70 111 71 32 29 41 132 39 84 62 27 92 55 117 129 125 127 104 74 114 14 145 36 121 22 69 68 133 59 65 58 148 131 40 54 118 110 3 61 105 4 112 142 122 73 37 1 113 45 87 57 89 103 98 100 63 146 106...

output:

100 22 22 141 22 144 146 22 144 30 150 46 22 22 22 144 22 70 22 100 140 87 22 22 22 22 144 144 144 22 22 22 77 140 22 150 22 22 100 22 144 22 140 29 144 22 134 87 140 144 22 144 22 22 117 22 141 144 77 22 150 144 144 144 144 145 22 140 54 87 22 144 140 22 87 22 22 125 22 100 22 144 14 22 144 77 144 ...

result:

ok construction is correct.

Test #19:

score: 0
Accepted
time: 298ms
memory: 35828kb

input:

149 22201 150
59 87 57 143 9 144 61 104 129 116 26 50 73 24 138 78 82 137 4 100 81 69 101 140 102 115 149 18 42 54 16 28 75 74 130 70 35 12 29 36 2 121 62 37 21 64 71 133 110 96 58 67 59 128 124 56 106 103 53 107 49 141 90 105 8 1 65 13 146 77 83 22 134 84 108 119 44 15 32 88 17 79 48 33 46 120 111 ...

output:

140 86 140 130 112 86 140 140 86 86 86 86 17 133 86 133 140 86 86 142 86 86 86 86 94 140 142 140 140 86 86 140 86 110 140 86 86 86 140 61 133 86 140 133 86 86 140 144 86 86 86 86 19 133 86 61 133 70 133 86 86 86 91 136 63 142 86 86 86 133 91 133 140 86 91 86 86 133 110 86 86 96 140 140 17 86 140 91 ...

result:

ok construction is correct.

Test #20:

score: 0
Accepted
time: 300ms
memory: 36204kb

input:

149 22201 150
85 67 67 47 152 75 90 126 113 128 46 30 36 85 21 97 79 16 61 39 120 99 153 105 76 107 56 116 118 119 122 94 9 127 12 15 68 104 80 7 100 146 125 95 53 112 74 143 81 27 1 52 40 71 29 88 139 69 13 11 92 132 45 42 38 151 3 60 24 91 2 25 86 133 41 10 33 135 82 57 110 6 114 140 138 62 87 64 ...

output:

51 138 137 93 137 137 137 111 137 137 137 111 109 60 79 111 137 143 51 148 137 137 143 81 137 132 127 137 137 111 138 137 137 88 148 137 137 79 137 19 137 143 111 111 137 137 143 137 129 73 148 137 137 111 137 28 36 137 137 137 111 137 72 137 111 19 137 111 111 51 137 143 111 138 81 137 138 51 111 1...

result:

ok construction is correct.

Test #21:

score: 0
Accepted
time: 278ms
memory: 37200kb

input:

149 22201 150
20 14 155 45 96 11 71 74 38 143 146 165 31 128 56 133 137 127 4 75 108 44 69 77 141 55 113 22 163 54 67 29 23 37 63 148 25 117 97 65 89 76 51 112 139 151 109 66 82 114 13 80 73 119 61 84 53 40 156 24 20 164 50 122 124 158 8 118 7 120 160 154 152 145 46 138 30 162 132 16 59 15 91 94 52 ...

output:

23 124 23 23 124 137 124 2 23 23 23 23 2 124 23 23 124 2 23 23 23 124 25 53 124 23 123 23 124 100 12 23 124 23 124 124 23 124 23 111 23 23 124 23 124 23 51 59 23 124 100 124 23 23 23 23 23 124 12 23 91 23 124 81 12 23 2 2 23 2 23 53 137 59 53 23 137 124 28 23 23 23 23 23 23 23 23 124 12 23 124 23 23...

result:

ok construction is correct.

Test #22:

score: 0
Accepted
time: 794ms
memory: 81412kb

input:

149 22201 150
64 32 323179 933179 87351 997262 611605 404909 732640 452641 642757 539724 945803 438567 594564 413639 542011 13240 428009 469975 976134 998911 916345 580907 215711 24916 933666 193524 159822 766638 161868 151754 502972 194801 55497 466348 151018 849178 317067 34382 293653 929582 83436...

output:

323179 839038 548746 594030 981148 155474 228715 935714 891291 192278 885592 375657 645679 379164 904065 89577 68781 395489 133839 60599 192099 749454 217164 57843 609649 706673 817167 507966 310340 850425 402960 491551 757038 532308 742198 820290 686368 209316 940630 278983 901799 760318 941722 289...

result:

ok construction is correct.

Subtask #5:

score: 21
Accepted

Test #23:

score: 21
Accepted
time: 294ms
memory: 36196kb

input:

150 22500 150
117 116 91 74 113 95 110 26 141 115 38 66 71 138 17 83 112 99 149 18 3 44 15 28 53 114 96 37 7 145 20 109 80 19 117 16 63 27 42 137 135 132 14 39 1 148 147 30 68 126 12 32 57 67 119 139 124 46 133 24 36 51 69 88 131 60 86 140 102 29 100 150 35 123 84 85 90 105 75 45 77 143 130 127 98 7...

output:

111 111 105 105 111 113 113 111 6 113 111 77 105 105 105 111 37 111 113 77 111 111 111 111 35 113 113 111 105 113 122 106 111 113 113 111 105 111 54 111 105 111 111 111 111 111 111 122 111 113 113 111 111 113 111 105 111 58 111 111 35 111 113 68 111 111 58 111 111 68 58 77 109 58 113 28 113 111 144 ...

result:

ok construction is correct.

Test #24:

score: 0
Accepted
time: 295ms
memory: 35828kb

input:

150 22500 150
147 68 107 8 61 49 133 15 148 55 122 84 72 75 29 19 118 99 51 79 142 117 11 50 149 69 87 45 73 92 41 110 56 144 128 47 77 78 141 48 31 53 136 103 94 26 145 151 121 46 101 58 38 10 102 126 22 140 138 40 129 96 82 150 95 30 27 100 28 13 114 74 81 52 116 17 4 143 66 90 20 2 111 21 7 91 68...

output:

44 18 136 3 102 122 18 139 112 18 18 44 51 18 29 18 18 122 122 122 18 18 18 122 44 95 144 18 18 18 44 112 136 18 18 122 122 18 18 112 122 18 18 122 18 136 122 18 136 14 18 136 122 18 18 18 95 18 100 122 18 18 18 14 122 122 143 122 122 112 148 18 122 18 69 18 112 18 18 18 26 66 18 18 14 18 9 122 58 1...

result:

ok construction is correct.

Test #25:

score: 0
Accepted
time: 308ms
memory: 35960kb

input:

150 22500 150
53 59 70 142 54 108 56 6 22 92 39 80 38 84 125 144 117 127 74 71 40 140 33 146 145 72 85 44 128 45 86 94 93 66 34 52 21 59 57 137 78 120 63 67 13 124 2 126 60 76 79 102 116 100 23 150 58 115 107 82 104 138 97 151 106 131 152 42 132 77 32 11 89 55 30 31 95 49 65 96 141 135 17 114 143 14...

output:

64 5 64 140 64 64 64 42 7 64 42 64 98 5 42 64 64 42 42 64 42 64 64 42 64 64 64 64 64 72 72 42 101 42 2 95 42 95 1 33 42 64 42 64 144 64 64 40 64 42 64 101 42 42 42 129 72 64 64 64 64 60 95 64 21 64 60 64 60 72 44 44 64 95 64 60 64 5 60 60 64 42 31 60 42 5 64 64 64 64 64 101 42 42 60 42 101 72 60 64 ...

result:

ok construction is correct.

Test #26:

score: 0
Accepted
time: 302ms
memory: 36256kb

input:

150 22500 150
81 87 83 67 109 57 147 69 102 72 25 29 39 94 56 73 27 41 81 53 144 101 135 117 127 96 5 145 155 22 87 106 38 19 14 86 58 97 20 35 65 124 47 93 50 10 75 80 52 31 76 154 126 78 91 113 42 118 9 115 15 51 149 141 119 134 92 74 64 129 66 103 110 49 85 143 133 148 12 61 142 151 131 153 21 34...

output:

86 31 63 31 112 31 31 63 63 63 4 31 31 63 31 31 4 122 4 86 31 86 31 6 31 4 31 63 31 155 31 31 31 31 122 4 63 8 31 4 31 122 31 31 31 31 122 31 6 31 86 31 4 4 31 86 86 63 4 31 31 66 86 122 31 63 26 89 90 63 31 31 63 122 63 4 63 4 66 31 31 41 31 129 40 31 63 63 155 148 122 31 4 41 86 31 31 31 122 63 86...

result:

ok construction is correct.

Test #27:

score: 0
Accepted
time: 280ms
memory: 37196kb

input:

150 22500 150
21 135 30 53 162 62 34 163 112 104 16 67 48 161 137 99 94 93 158 20 70 91 12 148 40 24 141 131 29 132 14 44 31 7 167 146 35 113 45 39 136 84 142 108 87 123 129 85 58 134 5 166 28 73 128 56 80 147 155 6 149 76 41 36 88 66 121 86 168 97 63 47 26 116 169 151 95 15 100 19 50 103 98 126 38 ...

output:

49 49 49 121 44 49 49 17 49 49 20 108 49 49 49 118 49 44 44 44 49 49 121 44 51 66 62 49 17 121 49 49 49 49 126 63 49 49 49 44 49 106 49 121 121 49 154 121 49 121 49 153 154 33 49 121 121 17 112 121 121 121 121 44 49 126 118 144 49 49 121 44 121 49 49 27 49 49 44 49 112 49 121 154 121 44 112 121 121 ...

result:

ok construction is correct.

Test #28:

score: 0
Accepted
time: 782ms
memory: 82148kb

input:

150 22500 150
142 84 95127 811376 352518 34572 172491 645409 426070 585385 839136 465937 516075 461423 149284 929627 554965 743036 475305 268781 574670 840165 214086 131675 655651 402556 295405 797734 729790 132978 283490 807542 165311 188276 808619 466578 568749 15488 450230 528624 262879 824125 58...

output:

320321 983994 61352 339078 885508 261337 870536 434229 133921 922116 578723 853773 809838 314335 309113 745900 587746 757083 614479 102892 859533 288092 863766 543416 327851 69803 39171 516641 953787 632904 628674 911725 479484 95533 996971 385603 894581 931894 921741 694387 285553 652157 860649 779...

result:

ok construction is correct.

Subtask #6:

score: 0
Wrong Answer

Test #29:

score: 28
Accepted
time: 0ms
memory: 4164kb

input:

150 450 3
57 22 2 1 3
142 57 1 3 2
138 113 3 1 2
13 77 2 3 1
43 112 1 2 3
82 99 2 1 3
66 65 3 1 2
3 31 2 1 3
24 146 3 2 1
127 18 2 3 1
125 37 1 2 3
13 137 1 2 3
105 127 1 3 2
54 20 1 2 3
48 15 3 1 2
23 71 2 3 1
30 28 1 2 3
125 146 1 3 2
68 120 2 1 3
38 92 2 1 3
101 100 1 3 2
81 28 1 3 2
70 7 1 2 3
1...

output:

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

result:

ok construction is correct.

Test #30:

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

input:

150 450 3
148 73 905 1007 1204
72 13 614 952 114
72 3 1026 931 764
33 21 1143 204 536
19 112 694 1261 734
104 68 1057 72 1249
83 66 311 147 656
141 5 1349 1317 700
12 113 331 375 1165
49 7 1114 1149 1224
79 41 531 46 712
128 20 630 1175 399
35 74 421 1148 608
57 124 840 108 1238
63 22 922 403 203
35...

output:

1204 114 764 536 1261 72 147 700 375 1149 531 630 421 840 922 1032 910 379 198 708 890 211 42 654 939 976 1321 835 1233 94 212 1288 650 384 130 708 1052 797 249 564 1067 1012 529 567 46 1184 381 460 1068 1077 894 1321 535 1150 655 122 233 405 664 1317 49 25 41 1067 1342 1068 146 840 366 290 1195 118...

result:

ok construction is correct.

Test #31:

score: -28
Wrong Answer
time: 1ms
memory: 3940kb

input:

150 450 3
111 66 3 4 1
62 51 3 2 4
117 58 3 4 1
54 105 1 3 4
40 108 3 1 4
104 112 2 4 1
131 73 4 3 1
109 30 1 4 3
36 130 3 4 2
40 70 2 3 1
24 112 3 1 4
44 119 4 1 2
39 91 1 4 3
28 118 1 2 3
8 117 2 4 1
110 109 3 1 4
99 20 4 1 2
131 49 4 1 2
130 114 1 4 3
133 57 3 1 2
41 125 1 3 4
21 65 1 2 3
144 143...

output:

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

result:

wrong answer Integer -1 violates the range [1, 1350]