QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#20867 | #147. Floppy | ejudge | 28 | 66ms | 11180kb | C++11 | 5.0kb | 2022-02-20 00:17:39 | 2023-01-15 18:06:40 |
Judging History
floppy
/**
* user: budnikov-69c
* fname: Mikhail
* lname: Budnikov
* task: Floppy
* score: 63.864856
* date: 2020-12-03 12:05:08.414128
*/
#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(), x.end()
#define x first
#define y second
#define mp make_pair
#define mt make_tuple
void save_to_floppy(const string &bits);
const int T = 1 << 17;
int n;
int a[T];
int t[2 * T];
string buffer;
bool mode = time(0) % 2;
int arg(int i, int j) {
return a[i] > a[j] ? i : j;
}
void build() {
iota(t + T, t + 2 * T, 0);
for (int i = T - 1; i > 0; --i) {
t[i] = arg(t[i + i], t[i + i + 1]);
}
}
int query(int l, int r) {
int res = l;
for (l += T, r += T; l <= r; l /= 2, r /= 2) {
if (l % 2 == 1) {
res = arg(res, t[l++]);
}
if (r % 2 == 0) {
res = arg(res, t[r--]);
}
}
return res;
}
void rec_read(int l, int r, bool dir=false) {
if (l < r) {
buffer += '0';
int i = query(l, r - 1);
rec_read(l, i, mode);
rec_read(i + 1, r, !mode);
buffer += '1';
} else {
if (dir) {
buffer += "01";
}
}
}
void read_array(int subtask_id, const vector<int> &v) {
(void)subtask_id;
n = (int)v.size();
copy(all(v), a);
build();
rec_read(0, n);
buffer.erase(buffer.begin());
buffer.pop_back();
// cout << buffer << " " << buffer.size() << endl, exit(0);
save_to_floppy(buffer);
}
vector<int> g[T];
int where[T];
int cur_pos;
void precalc(int v) {
if (g[v].empty()) {
return;
}
if ((int)g[v].size() >= 1 + !mode) {
precalc(g[v].front());
}
where[v] = cur_pos++;
if ((int)g[v].size() >= 1 + mode) {
precalc(g[v].back());
}
}
vector<int> solve_queries(int subtask_id, int _n, const string &bits,
const vector<int> &ql,
const vector<int> &qr) {
fill_n(a, T, 0);
(void)subtask_id;
n = _n;
int ff = 0;
vector<int> st = {ff++};
for (char c : bits) {
assert(st.size());
if (c == '0') {
g[st.back()].push_back(ff);
st.push_back(ff++);
} else {
st.pop_back();
}
}
// for (int i = 0; i < ff; ++i) {
// if (g[i].empty()) {
// continue;
// }
// cout << i << "\t";
// for (int j : g[i]) {
// cout << j << " ";
// }
// cout << endl;
// }
cur_pos = 0;
precalc(0);
cur_pos = 0;
for (int i = 0; i < ff; ++i) {
if (g[i].size()) {
a[where[i]] = n - cur_pos++;
}
}
build();
vector<int> ans;
for (int i = 0; i < (int)ql.size(); ++i) {
ans.push_back(query(ql[i], qr[i]));
}
return ans;
}
#ifdef LC
namespace grader{
#define NMAX 100000
#define MMAX 100000
#define BITSMAX 2000000
int subtask_id, N, M;
std::vector<int> v, sorted_v;
std::vector<int> a, b;
std::vector<int> correct_answers;
// Print score to stdout and exit.
void score_and_exit(const double pts, const char *verdict) {
fprintf(stderr, "%s", verdict);
fprintf(stdout, "%f", pts);
exit(0);
}
// Contestant sent too many bits.
void too_many_bits() {
score_and_exit(0, "Too many stored bits!");
}
// Contestant did not send any bits.
void misformatted_stored_bits() {
score_and_exit(0, "Misformatted stored bits or save_to_floppy not called!");
}
// Contestant did not call the answer function.
void answer_not_provided() {
score_and_exit(0, "Answer not provided!");
}
// Contestant sent a wrong answer.
void wrong_answer() {
score_and_exit(0, "Wrong answer to query!");
}
// Contestant sent a correct answer.
void correct_answer() {
score_and_exit(1, "OK!");
}
void read_test() {
assert(scanf("%d", &subtask_id) == 1);
assert(scanf("%d%d", &N, &M) == 2);
assert(1 <= N && N <= NMAX);
assert(0 <= M && M <= MMAX);
v.resize(N);
for (int i = 0; i < N; ++i) {
assert(scanf("%d", &v[i]) == 1);
}
// Check all values are distinct.
sorted_v.resize(N);
for (int i = 0; i < N; ++i) {
sorted_v[i] = v[i];
}
std::sort(sorted_v.begin(), sorted_v.end());
for (int i = 0; i + 1 < N; ++i) {
assert(sorted_v[i] < sorted_v[i + 1]);
}
a.resize(M);
b.resize(M);
correct_answers.resize(M);
for (int i = 0; i < M; ++i) {
assert(scanf("%d%d%d", &a[i], &b[i], &correct_answers[i]) == 3);
assert(0 <= a[i] && a[i] <= correct_answers[i] &&
correct_answers[i] <= b[i] && b[i] < N);
}
}
void save_to_floppy(const std::string &bits) {
// cout << bits.size() << endl;
std::vector<int> contestant_answers = solve_queries(subtask_id, N, bits, a, b);
for (int i = 0; i < M; ++i) {
if (contestant_answers[i] != correct_answers[i]) {
wrong_answer();
}
}
correct_answer();
exit(0);
}
}
void save_to_floppy(const string &bs) {
grader::save_to_floppy(bs);
}
int main() {
// Read input data.
grader::read_test();
// Send subtask_id, v.
read_array(grader::subtask_id, grader::v);
grader::answer_not_provided();
return 0;
}
#endif
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 7
Accepted
Test #1:
score: 7
Accepted
time: 6ms
memory: 8512kb
input:
1 496 484 491 478 483 452 446 458 493 453 457 468 418 440 241 267 365 462 441 495 39 54 70 26 97 152 24 105 85 170 298 42 275 305 295 297 207 211 296 184 346 98 123 171 157 135 194 243 156 115 196 169 53 138 93 263 251 201 195 333 324 396 338 270 311 359 289 290 486 403 183 339 310 473 464 471 469 4...
output:
1498 0000110001100001110111100001101100001100001101101110011111000000000000001101100111011000110011110110001101110001100001101100111110000000011011000111101100001110000110011111100001111100111100000110111000110111100000001100111100011001111000001100011110110000110011100000110110011111110000000011110...
input:
1 496 1498 0000110001100001110111100001101100001100001101101110011111000000000000001101100111011000110011110110001101110001100001101100111110000000011011000111101100001110000110011111100001111100111100000110111000110111100000001100111100011001111000001100011110110000110011100000110110011111110000000...
output:
115 18 115 305 115 18 305 373 115 305 115 373 115 115 305 365 373 461 305 305 18 115 429 201 305 305 115 39 67 18 115 115 305 305 115 373 115 352 67 305 115 373 115 453 18 67 18 305 373 115 115 429 373 252 115 125 115 201 115 491 115 305 115 18 305 305 287 305 115 305 18 201 115 373 370 305 305 201 ...
result:
ok good job! L = 1498
Test #2:
score: 7
Accepted
time: 6ms
memory: 8440kb
input:
1 496 466 469 320 402 391 453 73 101 122 49 54 94 93 148 197 168 233 144 125 161 69 34 247 76 37 90 71 33 42 212 188 156 110 135 165 374 277 289 248 273 236 131 210 242 238 231 366 346 314 358 300 349 322 412 315 268 354 340 99 176 290 313 221 229 332 265 269 146 316 403 369 492 190 256 266 100 126 ...
output:
1498 0000011000011001110000000000110110000110110011110110011100001110001111100000111000011011110000001101110111110000110001100000110111000111111000011100011001111110000011100000001101101100011011100001100111011111001111110000000011011000000110110110001101110111000110001101111000000001111001110110110...
input:
1 496 1498 0000011000011001110000000000110110000110110011110110011100001110001111100000111000011011110000001101110111110000110001100000110111000111111000011100011001111110000011100000001101101100011011100001100111011111001111110000000011011000000110110110001101110111000110001101111000000001111001110...
output:
339 339 339 389 222 339 256 256 339 180 339 339 339 310 109 71 339 365 256 256 171 455 484 264 200 339 256 413 339 339 339 339 339 339 109 339 256 109 339 222 339 339 109 339 109 339 455 346 109 213 339 53 339 339 109 339 339 339 109 339 339 339 339 339 339 109 109 339 256 109 339 256 310 109 339 10...
result:
ok good job! L = 1498
Test #3:
score: 7
Accepted
time: 0ms
memory: 8360kb
input:
1 496 487 495 488 494 486 493 490 492 485 491 483 489 484 482 480 481 479 478 477 475 476 473 474 472 470 471 466 469 468 465 467 464 462 463 458 461 459 460 457 456 455 454 453 451 452 449 450 448 447 444 446 445 442 443 441 434 440 438 439 437 435 436 433 431 432 429 430 424 428 423 427 426 422 42...
output:
1332 0011000110001100011000110001100000110000001100011000011000110000110000110001100011000000001100011000001100001100001100011000011000011000110001100011000011000000110001100011000110000110001100011000011000001100011000110001100001100011000110000110001100001100011000110000011000110000011000011000110...
input:
1 496 1332 0011000110001100011000110001100000110000001100011000011000110000110000110001100011000000001100011000001100001100001100011000011000011000110001100011000011000000110001100011000110000110001100011000011000001100011000110001100001100011000110000110001100001100011000110000011000110000011000011...
output:
157 202 218 223 145 242 85 315 70 15 230 197 261 162 175 175 25 112 225 98 68 319 290 147 247 167 353 360 167 3 22 315 432 353 5 418 313 151 129 58 54 206 151 18 125 227 112 92 73 98 27 91 153 318 400 16 121 234 174 78 244 68 372 242 48 11 5 221 129 194 395 33 263 102 91 172 391 125 112 240 266 349 ...
result:
ok good job! L = 1332
Test #4:
score: 7
Accepted
time: 2ms
memory: 8784kb
input:
1 495 473 486 488 489 491 485 477 474 472 480 483 460 459 462 448 447 444 449 454 442 434 437 443 439 433 430 440 438 435 431 429 436 424 421 426 418 422 417 413 416 414 405 409 406 407 403 404 391 392 385 388 387 386 390 384 377 369 382 371 375 374 370 367 368 366 360 362 363 364 352 348 361 354 35...
output:
1478 0000001101101101100000000011110110000000111000000001111011000000011011100000111100000011110000001110000110000001100000110001100011000000011000011000111100000011100000110000011000000011011011000011100000001111000011000001100001100000000110110000001101100011000000000110110000011100111000110000011...
input:
1 495 1478 0000001101101101100000000011110110000000111000000001111011000000011011100000111100000011110000001110000110000001100000110001100011000000011000011000111100000011100000110000011000000011011011000011100000001111000011000001100001100000000110110000001101100011000000000110110000011100111000110...
output:
290 457 363 400 302 348 463 117 103 109 363 385 53 457 130 13 18 53 126 18 81 446 482 81 409 491 123 18 377 486 277 13 342 98 342 298 486 456 438 361 13 46 382 18 347 293 431 457 44 482 483 75 412 369 483 13 428 483 382 299 430 363 98 486 109 478 306 281 31 331 461 182 446 46 205 87 340 317 356 53 6...
result:
ok good job! L = 1478
Test #5:
score: 7
Accepted
time: 8ms
memory: 8396kb
input:
1 498 379 228 234 288 275 306 283 287 302 280 196 162 261 251 312 255 204 405 289 220 265 269 342 148 231 338 296 394 161 267 340 116 218 226 305 186 282 240 391 337 351 366 401 321 333 454 362 396 406 329 380 443 190 292 301 273 358 377 402 398 418 414 450 475 348 354 419 285 291 279 216 262 349 32...
output:
1506 0000000000011011001110000110110000011100111111000111110000000011011011100001101100111100000110110000011011011000110011111000011011011110001101111000000110110001101110000000011011001110110110011100111101110000001101100000110000110111100111001111001110000000001110001101110001101110000011000011011...
input:
1 498 1506 0000000000011011001110000110110000011100111111000111110000000011011011100001101100111100000110110000011011011000110011111000011011011110001101111000000110110001101110000000011011001110110110011100111101110000001101100000110000110111100111001111001110000000001110001101110001101110000011000...
output:
417 63 362 63 456 372 102 372 63 237 372 289 63 63 372 289 63 102 63 63 63 372 63 63 78 289 162 102 162 289 289 63 372 102 372 63 115 102 372 372 372 138 162 372 372 372 289 372 118 289 372 280 162 63 372 102 372 289 289 372 372 372 362 417 63 372 474 289 63 78 372 268 237 417 372 417 351 63 417 237...
result:
ok good job! L = 1506
Subtask #2:
score: 21
Accepted
Test #6:
score: 21
Accepted
time: 24ms
memory: 9056kb
input:
2 9998 941669562 945620824 923950848 951745929 487936934 545172907 544098433 249251812 620978276 575815248 584717207 588068187 353162497 679201670 592738155 438327774 762119945 576801563 408534366 592715009 525377786 603981493 -93758897 137509462 -38676966 -36724784 654920761 -595506762 -645387884 -...
output:
29990 000000011001110000000110001111000011011001111000111100000011100111000110001101111000000000001110110110110110001111000000011110011100000110011100011111100011001111100000110110011100000110001111111100000011001110011101100000110110110000000110111001110000011000111101101110000011001110000111001111...
input:
2 9998 29990 00000001100111000000011000111100001101100111100011110000001110011100011000110111100000000000111011011011011000111100000001111001110000011001110001111110001100111110000011011001110000011000111111110000001100111001110110000011011011000000011011100111000001100011110110111000001100111000011...
output:
6131 6131 359 6131 6131 6131 6131 359 6131 6131 2817 6131 359 6131 6131 5102 6131 1055 6131 7338 2817 6131 5760 5760 6131 6131 359 6131 6131 6664 6131 7884 6131 2817 7338 7338 8312 6131 6131 5102 6131 7338 6131 6131 6131 5760 6131 6131 6395 6131 6131 2817 6131 2118 8687 2471 6131 6131 6131 6131 7338...
result:
points 1.0 good job! L = 29990
Test #7:
score: 21
Accepted
time: 18ms
memory: 9024kb
input:
2 9999 731433813 672900155 -154266178 -142062752 810401507 609673796 544462551 633906986 571738102 936132990 790930862 713932885 583772218 618694605 415964624 125339983 752948390 446516496 494161410 870044586 267348103 415149513 140247028 139903914 573253228 -211705903 596809434 509194500 671221940 ...
output:
29892 000000000000001101111000011100111100000000110001111100011011110000000011000111100111001110000110111100111000000110110011100000110001100011011110011100000000011011110001100111100011001111000000001101101100111000001100011110000111011101110011100011001111100000011001110001111000011001110000011000...
input:
2 9999 29892 00000000000000110111100001110011110000000011000111110001101111000000001100011110011100111000011011110011100000011011001110000011000110001101111001110000000001101111000110011110001100111100000000110110110011100000110001111000011101110111001110001100111110000001100111000111100001100111000...
output:
4198 2380 6998 4198 4198 4198 6998 4198 4198 8541 4198 4198 4198 4198 4198 5400 4198 8286 3848 8849 4198 2037 5400 7980 2037 4198 4198 4198 4198 4198 4198 4198 7619 9045 4198 5400 4198 4198 4198 4198 2037 4198 4198 6998 4198 4198 4198 4198 4198 4198 8849 8849 7619 4198 4198 4198 4198 4198 4198 4198 ...
result:
points 1.0 good job! L = 29892
Test #8:
score: 21
Accepted
time: 10ms
memory: 9116kb
input:
2 9997 999646439 999877567 999615045 999572458 999465340 998602736 998754430 998562475 998183998 998108258 997864409 997668387 997816125 997387979 997110884 996840136 996816135 996727915 996673898 996724983 996388637 996660759 996075504 996307507 996029274 994026101 995863929 995531258 994972765 994...
output:
26778 001100000011000000011000000001100011000110000110000000000001100011000110001100001100000110000000011000001100001100011000011000110000011000000110000011000110001100000110001100000110001100001100001100011000011000011000110000011000110001100001100000110001100011000110001100011000011000011000110000...
input:
2 9997 26778 00110000001100000001100000000110001100011000011000000000000110001100011000110000110000011000000001100000110000110001100001100011000001100000011000001100011000110000011000110000011000110000110000110001100001100001100011000001100011000110000110000011000110001100011000110001100001100001100...
output:
1088 1215 5472 1158 7944 1502 3135 3011 3625 7853 396 2376 2480 2718 3625 2224 66 645 2239 4329 2871 2002 349 4713 963 1081 1075 302 384 3422 345 3651 2980 2891 1884 3288 1711 128 1812 8221 4866 980 1683 3879 1471 4534 1183 5748 5420 4153 311 4251 9426 2070 1185 2363 212 4405 3576 6882 6758 1175 312...
result:
points 1.0 good job! L = 26778
Test #9:
score: 21
Accepted
time: 10ms
memory: 9116kb
input:
2 9997 998075413 999768563 996994821 995848879 992447573 993627169 993755793 993838328 990880244 992269976 991969312 992511252 990615969 990854518 989858767 989576734 990174788 990535036 988582131 988861974 988343926 988904854 988679289 987728654 988224499 988144927 987476186 986075661 984274493 983...
output:
30042 001100000000000001101101100000110011100011000000011101100001100111000011000000000111100000001101100111000000001110000110011100000111011000001101110000001110000001101101100000000110011100011000000000011011001110000110110000111000000000110111000000110110110000000000110111000000000000001110000000...
input:
2 9997 30042 00110000000000000110110110000011001110001100000001110110000110011100001100000000011110000000110110011100000000111000011001110000011101100000110111000000111000000110110110000000011001110001100000000001101100111000011011000011100000000011011100000011011011000000000011011100000000000000111...
output:
2180 455 485 911 9955 7271 6982 9890 737 2764 9364 1214 639 1960 414 8137 7579 7130 308 8277 1409 8801 9229 1705 333 9851 2686 7725 7995 9118 3287 9917 7353 1790 26 8313 6210 7875 2347 7552 3061 2690 30 9917 3008 9054 9725 9755 6626 9214 7276 3464 9615 8305 8076 2328 599 3845 1453 9722 9074 6986 675...
result:
points 1.0 good job! L = 30042
Test #10:
score: 21
Accepted
time: 24ms
memory: 9032kb
input:
2 9996 858247159 442798730 530600104 557785258 -353636825 -522042815 -470118868 -915939541 -785438325 -68695070 108509921 10169473 -237573210 730447976 -260998254 -253035962 158696722 -91003900 600314055 292558809 168182086 279048883 463103031 504100858 320637761 399185676 413728072 629957268 280982...
output:
30068 000000000010000011100001000110001111110010011111000000011100111000010001111100001111110001111000100111111100011001000001001110011100011110000001001111111111100001110001100111110001000000111100111000111110000110001001110001100111110001001001111000111111100000001100100001110011111000010010011110...
input:
2 9996 30068 00000000001000001110000100011000111111001001111100000001110011100001000111110000111111000111100010011111110001100100000100111001110001111000000100111111111110000111000110011111000100000011110011100011111000011000100111000110011111000100100111100011111110000000110010000111001111100001001...
output:
4729 7373 2242 2242 338 940 4729 4729 8569 940 7373 7373 9560 7373 482 940 2242 7373 940 4729 3470 7373 7373 7373 6705 7373 7373 1199 4729 4783 2242 7373 7373 4729 940 940 6705 2242 4729 940 7373 7373 940 7373 7373 7373 7373 940 6705 2242 4729 2242 6705 7373 2242 4729 6705 7373 7373 940 2242 2242 73...
result:
points 1.0 good job! L = 30068
Subtask #3:
score: 0
Wrong Answer
Test #11:
score: 36.0781
Acceptable Answer
time: 66ms
memory: 10784kb
input:
3 39995 922975946 766568552 929754744 983095922 988967630 879723897 928174186 951250463 831467029 836738151 464712826 467214506 167661408 156498284 426000721 530835328 -35115993 -86200136 327603078 448684869 192895652 125768327 402822176 196767853 409109378 985776352 976681898 967347754 989156210 99...
output:
119860 00000000000001001111100000111000110000110001001111100001001111000010011100111111110010011111100000111001111100000001001001001111100011001111000110000100011001111000011000111111001111100001000100000111111000111110001100000110011100111001001000001111111111000110000000001001110001001111100010011...
input:
3 39995 119860 000000000000010011111000001110001100001100010011111000010011110000100111001111111100100111111000001110011111000000010010010011111000110011110001100001000110011110000110001111110011111000010001000001111110001111100011000001100111001110010010000011111111110001100000000010011100010011111...
output:
11215 3597 17919 17919 16794 7409 7409 17919 17919 17919 17919 17919 37333 16794 38000 37333 17919 8605 16794 17919 27076 17919 17919 17919 17240 12582 27076 17919 17919 37333 17919 11215 17919 17919 17919 17919 17919 17919 7409 17919 17919 17919 584 32471 3597 32471 28370 17919 3597 17919 39520 373...
result:
points 0.5010843520 good job! L = 119860
Test #12:
score: 36.1244
Acceptable Answer
time: 56ms
memory: 10964kb
input:
3 39999 867402172 685901466 686671636 711501842 903386066 833531940 941869841 155613808 75348538 621222078 361531803 494133420 183601186 469266981 615102900 778500747 967242098 906173922 878275917 950695497 896291806 891834174 648534298 781268592 646594891 772566083 814129180 955538985 702320755 372...
output:
119798 00000000000001000011111001110000100111000011000111111110000010011100100100001100011111111000001001110010011110001000110011110010011111110001001110001000111100111111000100011110000011000000110011111110000010011100010011111001110001111100010011100111111000000000010010011111000000011001110010001...
input:
3 39999 119798 000000000000010000111110011100001001110000110001111111100000100111001001000011000111111110000010011100100111100010001100111100100111111100010011100010001111001111110001000111100000110000001100111111100000100111000100111110011100011111000100111001111110000000000100100111110000000110011...
output:
26342 9725 33006 26342 4221 26342 26342 26342 22096 25742 4221 26342 26342 19941 31716 26342 37017 31716 16513 2293 26342 26342 16513 26342 31716 26342 31716 22096 31716 16513 16513 16513 7246 26342 16513 26342 29199 34715 26342 16513 16513 14546 13032 27508 16513 26342 26342 16513 4221 37017 26342 ...
result:
points 0.50172722320 good job! L = 119798
Test #13:
score: 28.5119
Acceptable Answer
time: 62ms
memory: 10940kb
input:
3 39999 999942157 999920759 999874133 999902533 999819991 999831518 999785254 999798240 999745461 999681177 999690072 999678043 999529806 999656013 999367471 999501765 999498631 999326775 999353567 999256847 999285607 999067567 999153844 998988618 999045678 999017050 998767814 999006932 998853649 99...
output:
133454 01001000110001100011001000110010001100011001000110001100011000110010001100011001001000110001100100011001001000110001100011000110001100100011000110010010001100100100011001000110010010001100100100100100011000110001100011001000110010010001100011001001001001000110010010010001100100100011001000110...
input:
3 39999 133454 010010001100011000110010001100100011000110010001100011000110001100100011000110010010001100011001000110010010001100011000110001100011001000110001100100100011001001000110010001100100100011001001001001000110001100011000110010001100100100011000110010010010010001100100100100011001001000110...
output:
9331 28322 15895 17633 4819 9380 18962 8175 12943 3121 33276 24495 23835 281 11609 2119 4296 18907 4734 9864 8595 9301 6423 7540 4409 11341 9722 745 6216 17596 30576 665 11330 1559 11285 5885 2545 10467 14703 9655 1345 9539 15122 3417 13491 8325 19130 5510 9130 13001 19577 1949 2991 5417 26009 10114...
result:
points 0.39599842270 good job! L = 133454
Test #14:
score: 0
Wrong Answer
time: 58ms
memory: 11180kb
input:
3 39997 999741536 998563309 999117238 999051426 999931575 998790342 998708277 999435518 998494006 999770772 999520752 999601843 999178766 999104397 998691983 999251186 998976540 998475511 999227922 999247583 998586910 998896453 998949171 998600846 998732343 997177247 997226941 998040189 997452681 99...
output:
119772 00010001100111100001001110011100011000010010011110000100111100001110001100000000111001110010000000110011100100000000110000000100100111100000110011100000001111000110000110010011110000110011100000000110000110000011001111000000001100001110000111000011000111100100000001001110000100111100000000010...
input:
3 39997 119772 000100011001111000010011100111000110000100100111100001001111000011100011000000001110011100100000001100111001000000001100000001001001111000001100111000000011110001100001100100111100001100111000000001100001100000110011110000000011000011100001110000110001111001000000010011100001001111000...
output:
34622 36735 468 4889 26859 1223 17019 470 39534 33353 26474 36053 13047 7402 30038 1036 10902 5238 385 28047 10799 38943 11856 36483 960 10254 4437 38145 31603 32015 1805 27446 37083 324 7648 30671 34075 1269 3363 6651 1665 37092 36002 29837 3563 8042 28822 4188 426 15584 6062 31562 19209 5493 5782 ...
result:
wrong answer wrong answer on query #1 (a = 21239, b = 34623): read 34622 but expected 34621