QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#103466#5447. 鸽子hos_lyric24 3053ms10856kbC++148.2kb2023-05-05 23:33:562023-05-05 23:33:58

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-05 23:33:58]
  • 评测
  • 测评结果:24
  • 用时:3053ms
  • 内存:10856kb
  • [2023-05-05 23:33:56]
  • 提交

answer

#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")

#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 <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; }


using U = unsigned __int128;
using Double = long double;
struct Solver {
  /*
    0^(not multiple of (2K+1)) ==> next 1^(>=2K+1)
    1^(not multiple of (2K+1)) ==> next 0^(>=3K+1)
    
    state
    0: empty
    [   1,  2K+1]: 0^1, ..., 0^(2K+1)
    [2K+2,  7K+2]: 0^1, ..., 0^(5K+1) (need >=3K+1)
    [7K+3,  9K+3]: 1^1, ..., 1^(2K+1)
    [9K+4, 13K+4]: 1^1, ..., 1^(4K+1) (need >=2K+1)
  */
  int K, N, V;
  inline int id0 (int k) { return (    0) + k; }
  inline int id00(int k) { return (2*K+1) + k; }
  inline int id1 (int k) { return (7*K+2) + k; }
  inline int id11(int k) { return (9*K+3) + k; }
  vector<vector<int>> trans;
  vector<vector<U>> dp;
  vector<vector<Double>> DP;
  Solver(int K_) : K(K_), N(-1), V(-1), dp{} {
    V = 13*K+5;
    trans.assign(V, vector<int>(2, -2));
    trans[0][0] = id0(1);
    trans[0][1] = id1(1);
    for (int k = 1; k <= 2*K+1; ++k) {
      trans[id0(k)][0] = id0((k == 2*K+1) ? 1 : (k + 1));
      trans[id0(k)][1] = (k % (2*K+1) != 0) ? id11(1) : id1(1);
    }
    for (int k = 1; k <= 5*K+1; ++k) {
      trans[id00(k)][0] = id00((k == 5*K+1) ? (3*K+1) : (k + 1));
      trans[id00(k)][1] = (k >= 3*K+1) ? ((k % (2*K+1) != 0) ? id11(1) : id1(1)) : -1;
    }
    for (int k = 1; k <= 2*K+1; ++k) {
      trans[id1(k)][0] = (k % (2*K+1) != 0) ? id00(1) : id0(1);
      trans[id1(k)][1] = id1((k == 2*K+1) ? 1 : (k + 1));
    }
    for (int k = 1; k <= 4*K+1; ++k) {
      trans[id11(k)][0] = (k >= 2*K+1) ? ((k % (2*K+1) != 0) ? id00(1) : id0(1)) : -1;
      trans[id11(k)][1] = id11((k == 4*K+1) ? (2*K+1) : (k + 1));
    }
    dp.emplace_back(V, 0);
    DP.emplace_back(V, 0);
    for (int u = 0; u < V; ++u) if (~trans[u][0] && ~trans[u][1]) {
      dp[0][u] = 1;
      DP[0][u] = 1;
    }
    for (int n = 1; ; ++n) {
      dp.emplace_back(V, 0);
      DP.emplace_back(V, 0);
      for (int u = 0; u < V; ++u) {
        for (int a = 0; a < 2; ++a) {
          const int v = trans[u][a];
          if (~v) {
            dp[n][u] += dp[n - 1][v];
            DP[n][u] += DP[n - 1][v];
          }
        }
      }
      const Double l = log(DP[n][0]) / log(2.0L);
      if (l >= 128) {
        N = n;
// cerr<<"K = "<<K<<": N = "<<N<<", log_2(DP[N][0]) = "<<l<<"; "<<(log(DP[N-1][trans[0][0]])/log(2.0L))<<" "<<(log(DP[N-1][trans[0][1]])/log(2.0L))<<endl;
        return;
      }
    }
  }
  string encode(U x) const {
    string s(N, '?');
    {
      int u = 0;
      for (int i = 0; i < N; ++i) {
        for (int a = 0; a < 2; ++a) {
          const int v = trans[u][a];
          if (~v) {
            if (x < dp[N - 1 - i][v]) {
              s[i] = '0' + a;
              u = v;
              break;
            } else {
              x -= dp[N - 1 - i][v];
            }
          }
        }
        assert(s[i] != '?');
      }
    }
// cerr<<s<<endl;
    return s;
  }
  U decode(const string &s) const {
    vector<int> sSum(N + 1, 0);
    vector<int> iss[2];
    for (int i = 0; i < N; ++i) {
      sSum[i + 1] = sSum[i] + (s[i] - '0');
      iss[s[i] - '0'].push_back(i);
    }
    // d = (# of 1) - sSum[n]
    static char f[1310][50][270];
    for (int i = 0; i < N; ++i) {
      for (int d = -K; d <= K; ++d) {
        fill(f[i][K + d], f[i][K + d] + V, -1);
      }
    }
    fill(f[N][K + 0], f[N][K + 0] + V, -2);
    for (int i = N; --i >= 0; ) {
      for (int d = -K; d <= K; ++d) for (int u = 0; u < V; ++u) {
        for (int a = 0; a < 2; ++a) {
          int pos = sSum[i] + d;
          if (a == 0) pos = i - pos;
          if (0 <= pos && pos < (int)iss[a].size() && abs(iss[a][pos] - i) <= K) {
            const int dd = d + a - (s[i] - '0');
            const int v = trans[u][a];
            if (abs(dd) <= K && ~v && ~f[i + 1][K + dd][v]) {
              f[i][K + d][u] = a;
              break;
            }
          }
        }
      }
    }
    assert(~f[0][K + 0][0]);
    U x = 0;
    {
      string ss(N, '?');
      int d = 0;
      int u = 0;
      for (int i = 0; i < N; ++i) {
        const int a = f[i][K + d][u];
        assert(~a);
        ss[i] = '0' + a;
        if (a == 1 && ~trans[u][0]) {
          x += dp[N - 1 - i][trans[u][0]];
        }
        d = d + a - (s[i] - '0');
        u = trans[u][a];
      }
// cerr<<ss<<endl;
    }
    return x;
  }
};


#include <string>

//you may define some global variables, but it does not work if you try to transfer any information from function pigeon_num or function send to function receive through these variables.
//you had better not use the same global variables in function send and in function receive.

/*
Taskid:         The index of the subtask. If it is subtask 2, then Taskid=2.
k:              The time threshold. Suppose the i-th pigeon taking off is the p_i-th one to land. It is guaranteed that abs(i-p_i)<=k.
return value:   The number of pigeons Little E will use.
*/
int pigeon_num(int Taskid, int k){
	//you may do some initialization for SEND function here
	
  const Solver solver(k);
  return solver.N;
  
	return 5;//change this into your code
}

/*
Taskid:         The index of the subtask. If it is subtask 2, then Taskid=2.
n:              The number of pigeons Little E will use. This equals the return value of function pigeon_num.
k:              The time threshold. Suppose the i-th pigeon taking off is the p_i-th one to land. It is guaranteed that abs(i-p_i)<=k.
msg:            The content of the message.
return value:	The order of the pigeons taking off. The length of this string must be n. return_value[i]='0' means the (i+1)-th pigeon taking off is black. return_value[i]='1' means the (i+1)-th pigeon taking off is white.
*/
std::string send(int Taskid, int n, int k, __uint128_t msg){
  const Solver solver(k);
  return solver.encode(msg);
  
	return "10101";//change this into your code
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

class Init{
public:
	Init(){
		//you may do some initialization for RECEIVE function here
	}
};

/*
Taskid:         The index of the subtask. If it is subtask 2, then Taskid=2.
k:              The time threshold. Suppose the i-th pigeon taking off is the p_i-th one to land. It is guaranteed that abs(i-p_i)<=k.
msg:			The order of the pigeons landing. Its length is equal to n. msg[i] denotes the color of the (i+1)-th pigeon watched landing by Little F. '0' means black and '1' means white.
return value:	The content of the message. It should be correct.
*/
__uint128_t receive(int Taskid, int k, const std::string &msg){
	const static Init init;
  
  const Solver solver(k);
  return solver.decode(msg);
  
	{//change this into your code
		__uint128_t hi = 5281683694948011861llu;
		__uint128_t lo = 3195384480471073102llu;
		return hi<<64|lo; //this value equals 97429867398990605044182047185430790478
	}
}


详细

Subtask #1:

score: 0
Time Limit Exceeded

Test #1:

score: 0
Time Limit Exceeded

input:

encode
0 6 1 444386057
1259251521813 3478565260041 1380014506318

input:

w3xtong0sw70x24jk9va60aqnef9rzgx08fedfyimsmhm15g2p5yqjm98pbtrbqf9z0dajxh0cu2l8gd95xrgjw4v0zd2gnfxer874n1obsey5lrtj85pef4vcjvgyf3jgcdbrnnmrgc19osn0hdzg4gbo0hq25kq55c7tteedfxv1zzoif59fn45lzjo2x3h82ns90cuqigsh4g7cxx665n4vv15y2jbc0o7lusftiz71dfbfi7ag2i498kdd1rrwvtymjyy8c6mqr8hzny6x71lfr4qrlsh0929wz1p79q...

input:

decode
0 6 10000 546
0 790304253394246655 18407619062683736065 8448682451283719040 6304036728675368831 18445934836758491136 1048905101737954 15527465986713181835 18406197933167869933 13723951103
0 1571752971417676799 18398435976732744706 6665318504397006592 13095728847615917823 18445904050684449280 ...

result:


Subtask #2:

score: 0
Time Limit Exceeded

Test #2:

score: 0
Time Limit Exceeded

input:

encode
1 20 1000 429620070
0 0 720
0 0 312
0 0 746
0 0 460
0 0 449
0 0 778
0 0 877
0 0 951
0 0 40
0 0 836
0 0 436
0 0 440
0 0 694
0 0 3
0 0 124
0 0 123
0 0 812
0 0 848
0 0 569
0 0 46
0 0 144
0 0 930
0 0 703
0 0 830
0 0 198
0 0 1023
0 0 291
0 0 804
0 0 356
0 0 122
0 0 77
0 0 162
0 0 337
0 0 461
0 0 3...

result:


Subtask #3:

score: 12
Accepted

Test #3:

score: 12
Accepted
time: 1101ms = 52ms + 1049ms
memory: 4196kb,7672kb

input:

encode
2 1 1000 436825046
0 0 600068
0 0 609400
0 0 1024294
0 0 791018
0 0 906125
0 0 350192
0 0 938169
0 0 978316
0 0 498345
0 0 859442
0 0 990072
0 0 996124
0 0 1013379
0 0 383142
0 0 355230
0 0 636760
0 0 138612
0 0 1014140
0 0 116388
0 0 286851
0 0 689038
0 0 996312
0 0 872409
0 0 137655
0 0 165...

input:

w3xtong0sw70x24jk9va60aqnef9rzgx08fedfyimsmhm15g2p5yqjm98pbtrbqf9z0dajxh0cu2l8gd95xrgjw4v0zd2gnfxer874n1obsey5lrtj85pef4vcjvgyf3jgcdbrnnmrgc19osn0hdzg4gbo0hq25kq55c7tteedfxv1zzoif59fn45lzjo2x3h82ns90cuqigsh4g7cxx665n4vv15y2jbc0o7lusftiz71dfbfi7ag2i498kdd1rrwvtymjyy8c6mqr8hzny6x71lfr4qrlsh0929wz1p79q...

input:

decode
2 1 10000 206
568 0 0 699389 2814
549 0 0 44520 5765
376 0 0 194280 191
293 0 0 354911 13376
219 0 0 768606 992
919 0 0 87508 1344
830 0 0 68232 3024
56 0 0 265125 15231
464 0 0 458990 11630
706 0 0 349530 47
718 0 0 449 7042
404 0 0 177797 13359
770 0 0 0 2062
373 0 0 700235 4437
538 0 0 323...

result:

ok Accepted using 206 pigeon(s).

Subtask #4:

score: 12
Accepted

Test #4:

score: 12
Accepted
time: 1096ms = 48ms + 1048ms
memory: 4424kb,7728kb

input:

encode
3 1 1000 387247419
0 0 0
0 0 1
0 0 2
0 0 3
0 0 4
0 0 5
0 0 6
0 0 7
0 0 8
0 0 9
0 0 10
0 0 11
0 0 12
0 0 13
0 0 14
0 0 15
0 0 16
0 0 17
0 0 18
0 0 19
0 0 20
0 0 21
0 0 22
0 0 23
0 0 24
0 0 25
0 0 26
0 0 27
0 0 28
0 0 29
0 0 30
0 0 31
0 0 32
0 0 33
0 0 34
0 0 35
0 0 36
0 0 37
0 0 38
0 0 39
0 0 ...

input:

w3xtong0sw70x24jk9va60aqnef9rzgx08fedfyimsmhm15g2p5yqjm98pbtrbqf9z0dajxh0cu2l8gd95xrgjw4v0zd2gnfxer874n1obsey5lrtj85pef4vcjvgyf3jgcdbrnnmrgc19osn0hdzg4gbo0hq25kq55c7tteedfxv1zzoif59fn45lzjo2x3h82ns90cuqigsh4g7cxx665n4vv15y2jbc0o7lusftiz71dfbfi7ag2i498kdd1rrwvtymjyy8c6mqr8hzny6x71lfr4qrlsh0929wz1p79q...

input:

decode
3 1 10000 206
831 0 0 8 5595
255 0 0 1 5125
456 0 0 2 14943
976 0 0 10 9536
269 0 0 1 5184
74 0 0 0 2730
863 0 0 9 88
239 0 0 1 2132
307 0 0 1 6656
722 0 0 5 16361
649 0 0 5 10623
950 0 0 6 8370
464 0 0 2 15688
413 0 0 1 12079
334 0 0 1 8123
356 0 0 2 10288
441 0 0 2 13396
85 0 0 0 1927
132 0...

result:

ok Accepted using 206 pigeon(s).

Test #5:

score: 12
Accepted
time: 1087ms = 52ms + 1035ms
memory: 4196kb,7592kb

input:

encode
3 1 1000 713192400
4398046511103 8796093022207 8796093022207
4398046511103 8796093022207 8796093022206
4398046511103 8796093022207 8796093022205
4398046511103 8796093022207 8796093022204
4398046511103 8796093022207 8796093022203
4398046511103 8796093022207 8796093022202
4398046511103 87960930...

input:

w3xtong0sw70x24jk9va60aqnef9rzgx08fedfyimsmhm15g2p5yqjm98pbtrbqf9z0dajxh0cu2l8gd95xrgjw4v0zd2gnfxer874n1obsey5lrtj85pef4vcjvgyf3jgcdbrnnmrgc19osn0hdzg4gbo0hq25kq55c7tteedfxv1zzoif59fn45lzjo2x3h82ns90cuqigsh4g7cxx665n4vv15y2jbc0o7lusftiz71dfbfi7ag2i498kdd1rrwvtymjyy8c6mqr8hzny6x71lfr4qrlsh0929wz1p79q...

input:

decode
3 1 10000 206
387 11720923512564876777 9184059354934247400 13729928778109441705 2699
729 11648023134777902056 18408526569845391344 9154411752829506981 6014
23 13963708421790761968 18425410605976715248 9117257046375283399 16199
872 11720925161832318441 9211080952698470376 13729928778109441698 ...

result:

ok Accepted using 206 pigeon(s).

Test #6:

score: 12
Accepted
time: 1122ms = 54ms + 1068ms
memory: 4316kb,7828kb

input:

encode
3 1 1000 645075111
4246499090569 7193484617445 1510706984766
4246499090569 7193484616421 1510706984766
277774756708 6376504105378 5077007084953
277774756708 6376504105378 5077006036377
2169844955743 2934781145354 222052734700
2169844955743 2934781145354 153333257964
1832565011110 407610944436...

input:

w3xtong0sw70x24jk9va60aqnef9rzgx08fedfyimsmhm15g2p5yqjm98pbtrbqf9z0dajxh0cu2l8gd95xrgjw4v0zd2gnfxer874n1obsey5lrtj85pef4vcjvgyf3jgcdbrnnmrgc19osn0hdzg4gbo0hq25kq55c7tteedfxv1zzoif59fn45lzjo2x3h82ns90cuqigsh4g7cxx665n4vv15y2jbc0o7lusftiz71dfbfi7ag2i498kdd1rrwvtymjyy8c6mqr8hzny6x71lfr4qrlsh0929wz1p79q...

input:

decode
3 1 10000 206
122 813954463430881279 17629367060548884386 16744089496668170306 10752
65 12211357760441597364 6714491606895344256 12976286748871469985 5311
410 6812447627280360770 17215983370617356214 9329960889953684107 16011
502 13866794221685870843 11954807012025401568 10385193830595258216 ...

result:

ok Accepted using 206 pigeon(s).

Test #7:

score: 12
Accepted
time: 1120ms = 55ms + 1065ms
memory: 4412kb,7824kb

input:

encode
3 1 1000 796959971
757876296036 803151227108 5906999289291
757876427108 803151227108 5906999289291
414948469704 2976884394850 4112975556107
689826376648 2976884394850 4112975556107
2550229927214 632225161890 3388963947500
2550229796142 632225161890 3388963947500
3575646418173 3779536410297 44...

input:

w3xtong0sw70x24jk9va60aqnef9rzgx08fedfyimsmhm15g2p5yqjm98pbtrbqf9z0dajxh0cu2l8gd95xrgjw4v0zd2gnfxer874n1obsey5lrtj85pef4vcjvgyf3jgcdbrnnmrgc19osn0hdzg4gbo0hq25kq55c7tteedfxv1zzoif59fn45lzjo2x3h82ns90cuqigsh4g7cxx665n4vv15y2jbc0o7lusftiz71dfbfi7ag2i498kdd1rrwvtymjyy8c6mqr8hzny6x71lfr4qrlsh0929wz1p79q...

input:

decode
3 1 10000 206
957 3200048358288656339 16782242055562225770 1139956833884585622 8064
190 12125988898090635274 15381951813872119803 6524263914878973866 14261
776 1013557814690121528 17363610607102719230 817913329719108064 11787
968 6124908587494272343 17585392264968249355 5457591954849637719 58...

result:

ok Accepted using 206 pigeon(s).

Test #8:

score: 12
Accepted
time: 1120ms = 49ms + 1071ms
memory: 4304kb,7784kb

input:

encode
3 1 1000 693059695
4048401499258 4987348031799 3275997589762
134993019813 7423310534504 8175994939428
2365792583990 619504649447 278990350194
2186070068696 87980415538 8540777555842
312290816283 4681173122127 3515380653989
1091271851038 7859252399813 5032803532911
4224470394765 5800962600676 ...

input:

w3xtong0sw70x24jk9va60aqnef9rzgx08fedfyimsmhm15g2p5yqjm98pbtrbqf9z0dajxh0cu2l8gd95xrgjw4v0zd2gnfxer874n1obsey5lrtj85pef4vcjvgyf3jgcdbrnnmrgc19osn0hdzg4gbo0hq25kq55c7tteedfxv1zzoif59fn45lzjo2x3h82ns90cuqigsh4g7cxx665n4vv15y2jbc0o7lusftiz71dfbfi7ag2i498kdd1rrwvtymjyy8c6mqr8hzny6x71lfr4qrlsh0929wz1p79q...

input:

decode
3 1 10000 206
944 12700115738248143375 13799081510769227839 16200222913863261686 14071
333 12153130356412012223 8022599375497810687 11718406540832370315 14871
663 612279398854163519 17346210089240331077 10850829616329790808 4095
371 8134618045881319427 15057834553096736380 126236276441877487 ...

result:

ok Accepted using 206 pigeon(s).

Test #9:

score: 12
Accepted
time: 1124ms = 53ms + 1071ms
memory: 4300kb,7824kb

input:

encode
3 1 1000 996974621
1465918033995 8457101583533 2732887869300
2047477281607 457558740065 82047769421
3369612178778 5142868648775 7112435514295
1676953693797 8303977116040 3379317631238
1270351245252 8087071185611 3752267838689
1099073829021 3918060109511 196597372399
1805633566742 231697456066...

input:

w3xtong0sw70x24jk9va60aqnef9rzgx08fedfyimsmhm15g2p5yqjm98pbtrbqf9z0dajxh0cu2l8gd95xrgjw4v0zd2gnfxer874n1obsey5lrtj85pef4vcjvgyf3jgcdbrnnmrgc19osn0hdzg4gbo0hq25kq55c7tteedfxv1zzoif59fn45lzjo2x3h82ns90cuqigsh4g7cxx665n4vv15y2jbc0o7lusftiz71dfbfi7ag2i498kdd1rrwvtymjyy8c6mqr8hzny6x71lfr4qrlsh0929wz1p79q...

input:

decode
3 1 10000 206
987 13729950435280770514 17631171954606832474 10087960706156284546 15663
11 256564465901787168 18175064745273556143 270355133032634940 6111
953 8233596480280100101 13095674936031297055 505462820682191037 1671
943 4659020546627266632 12118982075358806160 813613662555799422 10576
...

result:

ok Accepted using 206 pigeon(s).

Test #10:

score: 12
Accepted
time: 1122ms = 54ms + 1068ms
memory: 4436kb,7828kb

input:

encode
3 1 1000 467567359
1075396360258 2757333265695 4398049088394
3728381695575 7402391548472 4514883918814
1374799011090 7647171217921 190123995147
44790216706 5313744955794 3750821258544
3674429288572 5398376745208 3178068241044
1260815866700 2230538451318 1717701836490
1044427370366 52834961469...

input:

w3xtong0sw70x24jk9va60aqnef9rzgx08fedfyimsmhm15g2p5yqjm98pbtrbqf9z0dajxh0cu2l8gd95xrgjw4v0zd2gnfxer874n1obsey5lrtj85pef4vcjvgyf3jgcdbrnnmrgc19osn0hdzg4gbo0hq25kq55c7tteedfxv1zzoif59fn45lzjo2x3h82ns90cuqigsh4g7cxx665n4vv15y2jbc0o7lusftiz71dfbfi7ag2i498kdd1rrwvtymjyy8c6mqr8hzny6x71lfr4qrlsh0929wz1p79q...

input:

decode
3 1 10000 206
833 766032601673102683 15178819228939857791 15183047491276696879 10587
47 3242967169806718334 9550686064034360299 5788254331466241035 10754
374 4776866709548088253 18404932621842770496 431527154065692577 5803
809 143819975109385728 6191337978081688787 11311914761418272768 15848
...

result:

ok Accepted using 206 pigeon(s).

Test #11:

score: 12
Accepted
time: 1131ms = 57ms + 1074ms
memory: 4384kb,7680kb

input:

encode
3 1 1000 598036788
3547997613716 7162316100081 8474994690705
4217635124842 180044937399 6937652241686
408564532613 557239564866 425308736666
2835923397344 4287732741367 456253791399
3227938616436 6128713171348 7177177432788
1374104573980 5915479646691 6151311367707
3059957757246 6306455341132...

input:

w3xtong0sw70x24jk9va60aqnef9rzgx08fedfyimsmhm15g2p5yqjm98pbtrbqf9z0dajxh0cu2l8gd95xrgjw4v0zd2gnfxer874n1obsey5lrtj85pef4vcjvgyf3jgcdbrnnmrgc19osn0hdzg4gbo0hq25kq55c7tteedfxv1zzoif59fn45lzjo2x3h82ns90cuqigsh4g7cxx665n4vv15y2jbc0o7lusftiz71dfbfi7ag2i498kdd1rrwvtymjyy8c6mqr8hzny6x71lfr4qrlsh0929wz1p79q...

input:

decode
3 1 10000 206
493 9190329738914947521 9223160987803066080 2710610121055928779 16383
46 13853916599666096667 11815263888351881466 8347430591607660963 16320
797 3050380322627385181 12153600166569622103 14988395998660126906 8886
483 1166484392849059867 15869053478230544232 6502072086607692729 53...

result:

ok Accepted using 206 pigeon(s).

Test #12:

score: 12
Accepted
time: 1122ms = 49ms + 1073ms
memory: 4440kb,7728kb

input:

encode
3 1 1000 28894740
1443566967277 1002989687681 1829524951402
2602826929142 3747227685123 5901648707775
4033961264703 2505460965674 954993702922
197504067048 6474213203300 591897838873
397555092326 6176213152642 6542025690412
3023274830786 7743011454513 4574767952956
970089917475 7440994416681 ...

input:

w3xtong0sw70x24jk9va60aqnef9rzgx08fedfyimsmhm15g2p5yqjm98pbtrbqf9z0dajxh0cu2l8gd95xrgjw4v0zd2gnfxer874n1obsey5lrtj85pef4vcjvgyf3jgcdbrnnmrgc19osn0hdzg4gbo0hq25kq55c7tteedfxv1zzoif59fn45lzjo2x3h82ns90cuqigsh4g7cxx665n4vv15y2jbc0o7lusftiz71dfbfi7ag2i498kdd1rrwvtymjyy8c6mqr8hzny6x71lfr4qrlsh0929wz1p79q...

input:

decode
3 1 10000 206
373 430668907717943359 11661657714607497247 17766523494578831359 7170
912 13310451385812744823 829155999283939309 1070473639104737384 14399
370 2407384327704756392 649267213618571454 9607666033837928277 11909
536 6159797127625424301 9025987521878958427 16723967488602838288 5387
...

result:

ok Accepted using 206 pigeon(s).

Test #13:

score: 12
Accepted
time: 1125ms = 53ms + 1072ms
memory: 4196kb,7832kb

input:

encode
3 1 1000 153075579
2304211383706 293736539527 7132134054812
1741814038249 7432048048225 3566201720196
3995524894037 6019268388144 2122308190778
991763611900 7426700545379 6238866569725
1785152478736 8261949307035 7941066811713
1698097536347 6572651164624 728515473256
2495922753108 73793558276...

input:

w3xtong0sw70x24jk9va60aqnef9rzgx08fedfyimsmhm15g2p5yqjm98pbtrbqf9z0dajxh0cu2l8gd95xrgjw4v0zd2gnfxer874n1obsey5lrtj85pef4vcjvgyf3jgcdbrnnmrgc19osn0hdzg4gbo0hq25kq55c7tteedfxv1zzoif59fn45lzjo2x3h82ns90cuqigsh4g7cxx665n4vv15y2jbc0o7lusftiz71dfbfi7ag2i498kdd1rrwvtymjyy8c6mqr8hzny6x71lfr4qrlsh0929wz1p79q...

input:

decode
3 1 10000 206
805 4043502531380262973 18167449684601602285 8051308042338958465 12030
871 5423859363030237147 18020413936166201985 9118280808519955792 5782
766 1011903357582299011 18102030711614903819 9257721016212000800 1023
838 13926691287133520231 499193686332539134 1151848209795003461 1026...

result:

ok Accepted using 206 pigeon(s).

Test #14:

score: 12
Accepted
time: 1115ms = 54ms + 1061ms
memory: 4424kb,7772kb

input:

encode
3 1 1000 894332930
2955022174032 3761127475788 6784502660817
1358878196429 7041902343860 5015929060416
285458360642 2724603455779 7746008164623
2279314129864 6384657611867 2131794287371
257082688144 5238759256510 2566576491022
2169514347865 3464239198787 8180660151008
2545389745640 3215011118...

input:

w3xtong0sw70x24jk9va60aqnef9rzgx08fedfyimsmhm15g2p5yqjm98pbtrbqf9z0dajxh0cu2l8gd95xrgjw4v0zd2gnfxer874n1obsey5lrtj85pef4vcjvgyf3jgcdbrnnmrgc19osn0hdzg4gbo0hq25kq55c7tteedfxv1zzoif59fn45lzjo2x3h82ns90cuqigsh4g7cxx665n4vv15y2jbc0o7lusftiz71dfbfi7ag2i498kdd1rrwvtymjyy8c6mqr8hzny6x71lfr4qrlsh0929wz1p79q...

input:

decode
3 1 10000 206
251 1709820491186217341 379626319650930683 12321052482725751440 1367
770 9223090697714748183 9205481781000007739 16212674859973533639 2311
237 12212964768218442240 12105715788258379776 4659161424732280501 5954
800 8197034514516517186 14357866764404021920 296094839542623169 7816
...

result:

ok Accepted using 206 pigeon(s).

Test #15:

score: 12
Accepted
time: 1118ms = 48ms + 1070ms
memory: 4428kb,7832kb

input:

encode
3 1 1000 870750617
2049300775717 3418691816781 170555247826
2138475130880 5872645360995 1575658908453
640612892047 8076474179327 4264407368088
887395543201 1149225882701 2807256545780
944441053874 6589872600342 4383690630196
2114663508024 5302653587328 6229477040546
3336805585458 774686815837...

input:

w3xtong0sw70x24jk9va60aqnef9rzgx08fedfyimsmhm15g2p5yqjm98pbtrbqf9z0dajxh0cu2l8gd95xrgjw4v0zd2gnfxer874n1obsey5lrtj85pef4vcjvgyf3jgcdbrnnmrgc19osn0hdzg4gbo0hq25kq55c7tteedfxv1zzoif59fn45lzjo2x3h82ns90cuqigsh4g7cxx665n4vv15y2jbc0o7lusftiz71dfbfi7ag2i498kdd1rrwvtymjyy8c6mqr8hzny6x71lfr4qrlsh0929wz1p79q...

input:

decode
3 1 10000 206
768 2641936504133186740 1566454475311284187 18233527525779046399 11520
958 2412399442581773591 13756654116086523951 11542725773888204074 2235
843 12680500327447093247 11529262049069361153 97946878044539541 11531
555 1722814835302855716 12972805663124045919 16814928119259103317 2...

result:

ok Accepted using 206 pigeon(s).

Test #16:

score: 12
Accepted
time: 1085ms = 52ms + 1033ms
memory: 4332kb,7684kb

input:

encode
3 1 1000 247578299
632583137590 7703348930412 784707894348
632583137590 7703348930412 784707894349
632583137590 7703348930412 784707894350
632583137590 7703348930412 784707894351
632583137590 7703348930412 784707894352
632583137590 7703348930412 784707894353
632583137590 7703348930412 7847078...

input:

w3xtong0sw70x24jk9va60aqnef9rzgx08fedfyimsmhm15g2p5yqjm98pbtrbqf9z0dajxh0cu2l8gd95xrgjw4v0zd2gnfxer874n1obsey5lrtj85pef4vcjvgyf3jgcdbrnnmrgc19osn0hdzg4gbo0hq25kq55c7tteedfxv1zzoif59fn45lzjo2x3h82ns90cuqigsh4g7cxx665n4vv15y2jbc0o7lusftiz71dfbfi7ag2i498kdd1rrwvtymjyy8c6mqr8hzny6x71lfr4qrlsh0929wz1p79q...

input:

decode
3 1 10000 206
660 861595708043230935 8465448249311368703 4814451152436637136 11542
257 854840308602175191 15382977276952450559 4814444555366870437 4794
554 861877166913748791 13365786856356056575 4746855444230204880 3647
462 861595656503623389 15382977276952450559 4814451152436637136 42
141 8...

result:

ok Accepted using 206 pigeon(s).

Test #17:

score: 12
Accepted
time: 1115ms = 52ms + 1063ms
memory: 4276kb,7672kb

input:

encode
3 1 1000 274474902
3167682591029 7992474326625 3651930268966
3167682591029 7992474326625 3651930268967
3167682591029 7992474326625 3651930268968
3167682591029 7992474326625 3651930268969
3167682591029 7992474326625 3651930268970
3167682591029 7992474326625 3651930268971
3167682591029 79924743...

input:

w3xtong0sw70x24jk9va60aqnef9rzgx08fedfyimsmhm15g2p5yqjm98pbtrbqf9z0dajxh0cu2l8gd95xrgjw4v0zd2gnfxer874n1obsey5lrtj85pef4vcjvgyf3jgcdbrnnmrgc19osn0hdzg4gbo0hq25kq55c7tteedfxv1zzoif59fn45lzjo2x3h82ns90cuqigsh4g7cxx665n4vv15y2jbc0o7lusftiz71dfbfi7ag2i498kdd1rrwvtymjyy8c6mqr8hzny6x71lfr4qrlsh0929wz1p79q...

input:

decode
3 1 10000 206
886 13021079357946343407 13415871443670425225 8889896758733127869 21
224 13021079357946343407 13415027018740293281 8889895109465686202 8448
743 8392506816631681007 8943568315407679240 18221424455374028920 8087
425 8410501372392251383 8942987770985987856 18228110586085867639 8429...

result:

ok Accepted using 206 pigeon(s).

Test #18:

score: 12
Accepted
time: 1105ms = 52ms + 1053ms
memory: 4432kb,7732kb

input:

encode
3 1 1000 18588105
3133225748585 1596243425390 5250091065049
3133225748585 1596243425390 5250091065050
3133225748585 1596243425390 5250091065051
3133225748585 1596243425390 5250091065052
3133225748585 1596243425390 5250091065053
3133225748585 1596243425390 5250091065054
3133225748585 159624342...

input:

w3xtong0sw70x24jk9va60aqnef9rzgx08fedfyimsmhm15g2p5yqjm98pbtrbqf9z0dajxh0cu2l8gd95xrgjw4v0zd2gnfxer874n1obsey5lrtj85pef4vcjvgyf3jgcdbrnnmrgc19osn0hdzg4gbo0hq25kq55c7tteedfxv1zzoif59fn45lzjo2x3h82ns90cuqigsh4g7cxx665n4vv15y2jbc0o7lusftiz71dfbfi7ag2i498kdd1rrwvtymjyy8c6mqr8hzny6x71lfr4qrlsh0929wz1p79q...

input:

decode
3 1 10000 206
71 8662464939203195933 5892990917938833155 13685832919153757814 8256
46 12996617755845178411 5954367857030945413 15991566543079257517 16239
950 13284285182077794348 16341359646695807619 15993364794346493566 13375
902 12994928905985700907 5956056706891209349 15991566543079257533 ...

result:

ok Accepted using 206 pigeon(s).

Test #19:

score: 12
Accepted
time: 1234ms = 48ms + 1186ms
memory: 4280kb,7820kb

input:

encode
3 1 1000 845512879
1567990344849 585423451066 7710202686455
1567990344849 585423451066 7710202686456
1567990344849 585423451066 7710202686457
1567990344849 585423451066 7710202686458
1567990344849 585423451066 7710202686459
1567990344849 585423451066 7710202686460
1567990344849 585423451066 7...

input:

w3xtong0sw70x24jk9va60aqnef9rzgx08fedfyimsmhm15g2p5yqjm98pbtrbqf9z0dajxh0cu2l8gd95xrgjw4v0zd2gnfxer874n1obsey5lrtj85pef4vcjvgyf3jgcdbrnnmrgc19osn0hdzg4gbo0hq25kq55c7tteedfxv1zzoif59fn45lzjo2x3h82ns90cuqigsh4g7cxx665n4vv15y2jbc0o7lusftiz71dfbfi7ag2i498kdd1rrwvtymjyy8c6mqr8hzny6x71lfr4qrlsh0929wz1p79q...

input:

decode
3 1 10000 206
97 3351428558955984128 6719746607171025834 1566051202335255126 16192
99 2234254926087632384 4413780485960920946 1043409612281486393 16199
282 3351178413617368576 4287659870805605297 1620010827467987515 15388
726 3351428558956180736 6719746655492550570 1565840096103508575 11567
8...

result:

ok Accepted using 206 pigeon(s).

Test #20:

score: 12
Accepted
time: 1197ms = 54ms + 1143ms
memory: 4388kb,7800kb

input:

encode
3 1 1000 51521257
1711052453544 163643731485 4994453213835
1711052453544 163643731485 4994453213836
1711052453544 163643731485 4994453213837
1711052453544 163643731485 4994453213838
1711052453544 163643731485 4994453213839
1711052453544 163643731485 4994453213840
1711052453544 163643731485 49...

input:

w3xtong0sw70x24jk9va60aqnef9rzgx08fedfyimsmhm15g2p5yqjm98pbtrbqf9z0dajxh0cu2l8gd95xrgjw4v0zd2gnfxer874n1obsey5lrtj85pef4vcjvgyf3jgcdbrnnmrgc19osn0hdzg4gbo0hq25kq55c7tteedfxv1zzoif59fn45lzjo2x3h82ns90cuqigsh4g7cxx665n4vv15y2jbc0o7lusftiz71dfbfi7ag2i498kdd1rrwvtymjyy8c6mqr8hzny6x71lfr4qrlsh0929wz1p79q...

input:

decode
3 1 10000 206
175 3457945830764499135 12391573652388147176 13834741355483539989 5471
704 3457944181497057471 12384818252947091432 13834741355483540032 4655
105 3457945830764499135 12391573652388147176 13834741252404324885 1391
810 3457945830764499135 12384818252947091432 13834741252404324929 ...

result:

ok Accepted using 206 pigeon(s).

Test #21:

score: 12
Accepted
time: 1085ms = 57ms + 1028ms
memory: 4440kb,7672kb

input:

encode
3 1 1000 695519242
2535264499835 7394105938009 7092345870659
2535264499835 7394105938009 7092345870660
2535264499835 7394105938009 7092345870661
2535264499835 7394105938009 7092345870662
2535264499835 7394105938009 7092345870663
2535264499835 7394105938009 7092345870664
2535264499835 73941059...

input:

w3xtong0sw70x24jk9va60aqnef9rzgx08fedfyimsmhm15g2p5yqjm98pbtrbqf9z0dajxh0cu2l8gd95xrgjw4v0zd2gnfxer874n1obsey5lrtj85pef4vcjvgyf3jgcdbrnnmrgc19osn0hdzg4gbo0hq25kq55c7tteedfxv1zzoif59fn45lzjo2x3h82ns90cuqigsh4g7cxx665n4vv15y2jbc0o7lusftiz71dfbfi7ag2i498kdd1rrwvtymjyy8c6mqr8hzny6x71lfr4qrlsh0929wz1p79q...

input:

decode
3 1 10000 206
354 12154459654173929303 11721418065320279883 17636013770788476855 11007
315 12154446466476846935 11721424662390046539 17636013770788476855 10251
331 12154459654173929303 11721424662390046539 17636013770788476855 10587
790 12154446460034395991 11721424662390046539 17636013770788...

result:

ok Accepted using 206 pigeon(s).

Subtask #5:

score: 0
Time Limit Exceeded

Test #22:

score: 12
Accepted
time: 3053ms = 92ms + 2961ms
memory: 4688kb,10856kb

input:

encode
4 2 1000 104801283
0 0 0
0 0 1
0 0 2
0 0 3
0 0 4
0 0 5
0 0 6
0 0 7
0 0 8
0 0 9
0 0 10
0 0 11
0 0 12
0 0 13
0 0 14
0 0 15
0 0 16
0 0 17
0 0 18
0 0 19
0 0 20
0 0 21
0 0 22
0 0 23
0 0 24
0 0 25
0 0 26
0 0 27
0 0 28
0 0 29
0 0 30
0 0 31
0 0 32
0 0 33
0 0 34
0 0 35
0 0 36
0 0 37
0 0 38
0 0 39
0 0 ...

input:

w3xtong0sw70x24jk9va60aqnef9rzgx08fedfyimsmhm15g2p5yqjm98pbtrbqf9z0dajxh0cu2l8gd95xrgjw4v0zd2gnfxer874n1obsey5lrtj85pef4vcjvgyf3jgcdbrnnmrgc19osn0hdzg4gbo0hq25kq55c7tteedfxv1zzoif59fn45lzjo2x3h82ns90cuqigsh4g7cxx665n4vv15y2jbc0o7lusftiz71dfbfi7ag2i498kdd1rrwvtymjyy8c6mqr8hzny6x71lfr4qrlsh0929wz1p79q...

input:

decode
4 2 10000 284
588 0 0 0 0 13578343
566 0 0 0 0 13615103
278 0 0 0 0 524223
167 0 0 0 0 851455
188 0 0 0 0 1055227
660 0 0 0 0 20532352
542 0 0 0 0 13606496
285 0 0 0 0 3301582
771 0 0 0 0 27050796
681 0 0 0 0 8011424
34 0 0 0 0 26208
5 0 0 0 0 124
823 0 0 0 0 27262144
238 0 0 0 0 1669428
908 ...

result:

ok Accepted using 284 pigeon(s).

Test #23:

score: 0
Time Limit Exceeded

input:

encode
4 2 1000 66331895
4398046511103 8796093022207 8796093022207
4398046511103 8796093022207 8796093022206
4398046511103 8796093022207 8796093022205
4398046511103 8796093022207 8796093022204
4398046511103 8796093022207 8796093022203
4398046511103 8796093022207 8796093022202
4398046511103 879609302...

input:

w3xtong0sw70x24jk9va60aqnef9rzgx08fedfyimsmhm15g2p5yqjm98pbtrbqf9z0dajxh0cu2l8gd95xrgjw4v0zd2gnfxer874n1obsey5lrtj85pef4vcjvgyf3jgcdbrnnmrgc19osn0hdzg4gbo0hq25kq55c7tteedfxv1zzoif59fn45lzjo2x3h82ns90cuqigsh4g7cxx665n4vv15y2jbc0o7lusftiz71dfbfi7ag2i498kdd1rrwvtymjyy8c6mqr8hzny6x71lfr4qrlsh0929wz1p79q...

input:

decode
4 2 10000 284
977 10954582214230995718 8287066430434771047 18329657492782414142 6932165722941209854 103964879
780 10954582214230995718 8287066418353209447 18329657492782398782 6932165722941202175 50744735
244 16141463584751680002 18158748995731652655 18329653747572001719 9230127435222529535 2...

result:


Subtask #6:

score: 0
Time Limit Exceeded

Test #40:

score: 0
Time Limit Exceeded

input:

encode
5 5 1000 711903075
0 0 0
0 0 1
0 0 2
0 0 3
0 0 4
0 0 5
0 0 6
0 0 7
0 0 8
0 0 9
0 0 10
0 0 11
0 0 12
0 0 13
0 0 14
0 0 15
0 0 16
0 0 17
0 0 18
0 0 19
0 0 20
0 0 21
0 0 22
0 0 23
0 0 24
0 0 25
0 0 26
0 0 27
0 0 28
0 0 29
0 0 30
0 0 31
0 0 32
0 0 33
0 0 34
0 0 35
0 0 36
0 0 37
0 0 38
0 0 39
0 0 ...

input:

w3xtong0sw70x24jk9va60aqnef9rzgx08fedfyimsmhm15g2p5yqjm98pbtrbqf9z0dajxh0cu2l8gd95xrgjw4v0zd2gnfxer874n1obsey5lrtj85pef4vcjvgyf3jgcdbrnnmrgc19osn0hdzg4gbo0hq25kq55c7tteedfxv1zzoif59fn45lzjo2x3h82ns90cuqigsh4g7cxx665n4vv15y2jbc0o7lusftiz71dfbfi7ag2i498kdd1rrwvtymjyy8c6mqr8hzny6x71lfr4qrlsh0929wz1p79q...

input:

decode
5 5 10000 485
637 0 0 0 0 0 0 7 103062257664
884 0 0 0 0 0 0 141 128579697151
899 0 0 0 0 0 0 496 68694568835
967 0 0 0 0 0 0 541 127775280639
928 0 0 0 0 0 0 78 136465882111
928 0 0 0 0 0 0 496 60389716095
453 0 0 0 0 0 0 31 3220439007
600 0 0 0 0 0 0 124 9662660607
496 0 0 0 0 0 0 21 339906...

result:


Subtask #7:

score: 0
Time Limit Exceeded

Test #58:

score: 0
Time Limit Exceeded

input:

encode
6 7 1000 618359561
0 0 0
0 0 1
0 0 2
0 0 3
0 0 4
0 0 5
0 0 6
0 0 7
0 0 8
0 0 9
0 0 10
0 0 11
0 0 12
0 0 13
0 0 14
0 0 15
0 0 16
0 0 17
0 0 18
0 0 19
0 0 20
0 0 21
0 0 22
0 0 23
0 0 24
0 0 25
0 0 26
0 0 27
0 0 28
0 0 29
0 0 30
0 0 31
0 0 32
0 0 33
0 0 34
0 0 35
0 0 36
0 0 37
0 0 38
0 0 39
0 0 ...

input:

w3xtong0sw70x24jk9va60aqnef9rzgx08fedfyimsmhm15g2p5yqjm98pbtrbqf9z0dajxh0cu2l8gd95xrgjw4v0zd2gnfxer874n1obsey5lrtj85pef4vcjvgyf3jgcdbrnnmrgc19osn0hdzg4gbo0hq25kq55c7tteedfxv1zzoif59fn45lzjo2x3h82ns90cuqigsh4g7cxx665n4vv15y2jbc0o7lusftiz71dfbfi7ag2i498kdd1rrwvtymjyy8c6mqr8hzny6x71lfr4qrlsh0929wz1p79q...

input:

decode
6 7 10000 605
664 0 0 0 0 0 0 0 0 1081344 8378180
256 0 0 0 0 0 0 0 0 1040447 536870911
273 0 0 0 0 0 0 0 0 2080895 534806527
399 0 0 0 0 0 0 0 0 16647167 522207104
558 0 0 0 0 0 0 0 0 133173311 534839295
357 0 0 0 0 0 0 0 0 8323391 536870911
573 0 0 0 0 0 0 0 0 133174271 511770112
65 0 0 0 0...

result:


Subtask #8:

score: 0
Time Limit Exceeded

Test #76:

score: 0
Time Limit Exceeded

input:

encode
7 10 1000 211479294
0 0 0
0 0 1
0 0 2
0 0 3
0 0 4
0 0 5
0 0 6
0 0 7
0 0 8
0 0 9
0 0 10
0 0 11
0 0 12
0 0 13
0 0 14
0 0 15
0 0 16
0 0 17
0 0 18
0 0 19
0 0 20
0 0 21
0 0 22
0 0 23
0 0 24
0 0 25
0 0 26
0 0 27
0 0 28
0 0 29
0 0 30
0 0 31
0 0 32
0 0 33
0 0 34
0 0 35
0 0 36
0 0 37
0 0 38
0 0 39
0 0...

input:

w3xtong0sw70x24jk9va60aqnef9rzgx08fedfyimsmhm15g2p5yqjm98pbtrbqf9z0dajxh0cu2l8gd95xrgjw4v0zd2gnfxer874n1obsey5lrtj85pef4vcjvgyf3jgcdbrnnmrgc19osn0hdzg4gbo0hq25kq55c7tteedfxv1zzoif59fn45lzjo2x3h82ns90cuqigsh4g7cxx665n4vv15y2jbc0o7lusftiz71dfbfi7ag2i498kdd1rrwvtymjyy8c6mqr8hzny6x71lfr4qrlsh0929wz1p79q...

input:

decode
7 10 10000 773
795 0 0 0 0 0 0 0 0 0 0 63 17294386068543242495 31
690 0 0 0 0 0 0 0 0 0 0 6 3114775388578250635 0
829 0 0 0 0 0 0 0 0 0 0 63 17294455887766749183 31
424 0 0 0 0 0 0 0 0 0 0 0 576605887847709819 31
749 0 0 0 0 0 0 0 0 0 0 31 17870599980721438719 31
244 0 0 0 0 0 0 0 0 0 0 0 575...

result:


Subtask #9:

score: 0
Time Limit Exceeded

Test #94:

score: 0
Time Limit Exceeded

input:

encode
8 14 1000 963380543
0 0 0
0 0 1
0 0 2
0 0 3
0 0 4
0 0 5
0 0 6
0 0 7
0 0 8
0 0 9
0 0 10
0 0 11
0 0 12
0 0 13
0 0 14
0 0 15
0 0 16
0 0 17
0 0 18
0 0 19
0 0 20
0 0 21
0 0 22
0 0 23
0 0 24
0 0 25
0 0 26
0 0 27
0 0 28
0 0 29
0 0 30
0 0 31
0 0 32
0 0 33
0 0 34
0 0 35
0 0 36
0 0 37
0 0 38
0 0 39
0 0...

result:


Subtask #10:

score: 0
Time Limit Exceeded

Test #112:

score: 0
Time Limit Exceeded

input:

encode
9 20 1000 49682627
0 0 0
0 0 1
0 0 2
0 0 3
0 0 4
0 0 5
0 0 6
0 0 7
0 0 8
0 0 9
0 0 10
0 0 11
0 0 12
0 0 13
0 0 14
0 0 15
0 0 16
0 0 17
0 0 18
0 0 19
0 0 20
0 0 21
0 0 22
0 0 23
0 0 24
0 0 25
0 0 26
0 0 27
0 0 28
0 0 29
0 0 30
0 0 31
0 0 32
0 0 33
0 0 34
0 0 35
0 0 36
0 0 37
0 0 38
0 0 39
0 0 ...

result: