QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#783075#4252. Permutationisirazeev64.630769 7ms4564kbC++23861b2024-11-25 23:11:302024-11-25 23:11:32

Judging History

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

  • [2024-11-25 23:11:32]
  • 评测
  • 测评结果:64.630769
  • 用时:7ms
  • 内存:4564kb
  • [2024-11-25 23:11:30]
  • 提交

answer

#include <bits/stdc++.h>

#include "perm.h"

using namespace std;

std::vector<int> construct_permutation(long long k) {
    vector<long long> bt;
    int cnt = 0;
    for (int i = 0; i <= 60; i++) {
        if (((k >> i) & 1) == 1) {
            cnt++;
            bt.emplace_back(i);
        }
    }
    bt.emplace_back(cnt);
    if (cnt == 1) {
        vector<int> ans;
        for (int i = 0; i < bt[0]; i++) ans.emplace_back(i);
        return ans;
    }
    bt.back()--;
    deque<int> res;
    int cur = 0;
    for (int j = 0; j < (int) bt.size() - 1; j++) {
        int i = bt[j];
        for (int jj = cur + i - 1; jj >= cur; jj--)
            res.push_front(jj);
        cur += i;
    }
    for (int jj = cur; jj <= cur + bt.back() - 1; jj++)
        res.push_front(jj);
    vector<int> ans;
    for (int i: res) ans.emplace_back(i);
    return ans;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 1ms
memory: 3816kb

input:

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

output:

6cad0f33-b1bd-3a3e-1a8d-c4af23adfcbf
OK
1
0
2
1 0
2
0 1
3
2 0 1
4
3 1 2 0
5
4 3 1 2 0
3
0 1 2
4
3 0 1 2
5
4 1 2 3 0
6
5 4 1 2 3 0
6
5 2 3 4 0 1
7
6 5 2 3 4 0 1
8
7 6 3 4 5 1 2 0
9
8 7 6 3 4 5 1 2 0
4
0 1 2 3
5
4 0 1 2 3
6
5 1 2 3 4 0
7
6 5 1 2 3 4 0
7
6 2 3 4 5 0 1
8
7 6 2 3 4 5 0 1
9
8 7 3 4 5 6 1 ...

result:

ok 

Subtask #2:

score: 54.6308
Acceptable Answer

Test #2:

score: 81.6667
Acceptable Answer
time: 1ms
memory: 3912kb

input:

a92b3f80-b312-8377-273c-3916024d7f2a
100
39993
85709
48645
25391
15360
54084
28947
18808
86735
316
14357
82845
96210
16242
58466
43439
77462
70742
76176
20397
30314
22634
29622
81835
31904
81283
37072
36527
26764
55878
72762
5262
34915
63468
20595
66579
77373
36670
89340
83384
73268
31960
67318
3908...

output:

6cad0f33-b1bd-3a3e-1a8d-c4af23adfcbf
OK
67
66 65 64 63 62 61 60 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 33 34 35 36 37 38 39 40 41 42 43 44 22 23 24 25 26 27 28 29 30 31 32 12 13 14 15 16 17 18 19 20 21 7 8 9 10 11 3 4 5 6 0 1 2
87
86 85 84 83 82 81 80 79 78 62 63 64 65 66 67 68 69 70 71 72 73 ...

result:

points 0.90740740740

Test #3:

score: 74.2308
Acceptable Answer
time: 0ms
memory: 4180kb

input:

a92b3f80-b312-8377-273c-3916024d7f2a
100
2147483647
1073741823
536870911
268435455
134217727
67108863
33554431
16777215
8388607
4194303
2097151
1582
24319
38
463
7
1073741503
3
18
3
3780
2
24934
124910
65535
154
1069539071
209452285
1662
3
3
93
4070
131071
502986749
3164
268430159
247
21746
124927
1...

output:

6cad0f33-b1bd-3a3e-1a8d-c4af23adfcbf
OK
495
494 493 492 491 490 489 488 487 486 485 484 483 482 481 480 479 478 477 476 475 474 473 472 471 470 469 468 467 466 465 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 406 407 408 409 ...

result:

points 0.82478632480

Test #4:

score: 54.6308
Acceptable Answer
time: 4ms
memory: 4044kb

input:

a92b3f80-b312-8377-273c-3916024d7f2a
100
576460752303423487
288230376151711743
144115188075855871
72057594037927935
36028797018963967
18014398509481983
9007199254740991
4503599627370495
2251799813685247
1125899906842623
562949953421311
8166608599550
16508780543
33554427
43000192155799
62353919
71773...

output:

6cad0f33-b1bd-3a3e-1a8d-c4af23adfcbf
OK
1769
1768 1767 1766 1765 1764 1763 1762 1761 1760 1759 1758 1757 1756 1755 1754 1753 1752 1751 1750 1749 1748 1747 1746 1745 1744 1743 1742 1741 1740 1739 1738 1737 1736 1735 1734 1733 1732 1731 1730 1729 1728 1727 1726 1725 1724 1723 1722 1721 1720 1719 1718 ...

result:

points 0.6070085470

Test #5:

score: 72.9538
Acceptable Answer
time: 3ms
memory: 3964kb

input:

a92b3f80-b312-8377-273c-3916024d7f2a
100
336455856505
197522918480
260689715591
857530435844
89809708292
207893569808
702779448503
917149928374
643600357316
927175148543
51879726697
974331197849
721971572596
902469653832
936157710917
714588060426
276939435899
393954173900
692525720126
762289367234
1...

output:

6cad0f33-b1bd-3a3e-1a8d-c4af23adfcbf
OK
409
408 407 406 405 404 403 402 401 400 399 398 397 396 395 394 393 392 391 390 389 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 316 317 318 319 320 321 ...

result:

points 0.81059829060

Test #6:

score: 68.7846
Acceptable Answer
time: 4ms
memory: 4428kb

input:

a92b3f80-b312-8377-273c-3916024d7f2a
100
330061280882697
570108406837011
246465711199350
844437948491708
542197441405836
481743322695013
913237337833838
634038564781156
969749245791701
445335878892049
722391184659757
25600568975288
304176471716316
934030664268458
770565383569314
38589802113902
56387...

output:

6cad0f33-b1bd-3a3e-1a8d-c4af23adfcbf
OK
472
471 470 469 468 467 466 465 464 463 462 461 460 459 458 457 456 455 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 ...

result:

points 0.76427350430

Test #7:

score: 63.2308
Acceptable Answer
time: 7ms
memory: 4292kb

input:

a92b3f80-b312-8377-273c-3916024d7f2a
100
9808783958425241
800256975993528789
891794666437715812
154809014071580277
262143300778136084
508038278751820218
855062810898478629
196129157832150290
519747744582635554
544132224659269080
335568667826635843
978219202156109836
887928188166976766
57068450616591...

output:

6cad0f33-b1bd-3a3e-1a8d-c4af23adfcbf
OK
704
703 702 701 700 699 698 697 696 695 694 693 692 691 690 689 688 687 686 685 684 683 682 681 680 679 678 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 ...

result:

points 0.70256410260

Test #8:

score: 90
Accepted
time: 1ms
memory: 3796kb

input:

a92b3f80-b312-8377-273c-3916024d7f2a
100
576460752303423488
576460752303423489
576460752303423490
576460752303423491
576460752303423492
576460752303423493
576460752303423494
576460752303423495
576460752303423496
576460752303423497
576460752303423498
576460752303423499
576460752303423500
576460752303...

output:

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

result:

ok 

Test #9:

score: 64.8923
Acceptable Answer
time: 3ms
memory: 4072kb

input:

a92b3f80-b312-8377-273c-3916024d7f2a
100
999999999999999901
999999999999999902
999999999999999903
999999999999999904
999999999999999905
999999999999999906
999999999999999907
999999999999999908
999999999999999909
999999999999999910
999999999999999911
999999999999999912
999999999999999913
999999999999...

output:

6cad0f33-b1bd-3a3e-1a8d-c4af23adfcbf
OK
1087
1086 1085 1084 1083 1082 1081 1080 1079 1078 1077 1076 1075 1074 1073 1072 1071 1070 1069 1068 1067 1066 1065 1064 1063 1062 1061 1060 1059 1058 1057 1056 1055 1054 1053 1052 1051 1050 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006...

result:

points 0.7210256410

Test #10:

score: 63.0615
Acceptable Answer
time: 3ms
memory: 4200kb

input:

a92b3f80-b312-8377-273c-3916024d7f2a
100
333271685633113373
303681151173201623
185954994672690293
695000491456721509
680039555562404861
711731044985538439
725639770789026979
653124604194000671
716161846351295353
727816570890872159
566821251164212697
620956504691616073
845196440395453799
654653854021...

output:

6cad0f33-b1bd-3a3e-1a8d-c4af23adfcbf
OK
685
684 683 682 681 680 679 678 677 676 675 674 673 672 671 670 669 668 667 666 665 664 663 662 661 660 659 658 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 ...

result:

points 0.70068376070

Test #11:

score: 64.7231
Acceptable Answer
time: 5ms
memory: 4224kb

input:

a92b3f80-b312-8377-273c-3916024d7f2a
100
11260605527954640
3776579230632
1586488757700
753903936556020250
10601397297904140
810787108223734551
544021594614225000
609804018090927660
212587386929622705
334981274861463750
759012209987031
879302565815602500
156896254323644472
501935537823034315
23356411...

output:

6cad0f33-b1bd-3a3e-1a8d-c4af23adfcbf
OK
502
501 500 499 498 497 496 495 494 493 492 491 490 489 488 487 486 485 484 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 ...

result:

points 0.71914529910

Test #12:

score: 55.5385
Acceptable Answer
time: 6ms
memory: 4564kb

input:

a92b3f80-b312-8377-273c-3916024d7f2a
100
450283905890997362
288230376151711743
298023223876953124
789730223053602815
558545864083284006
144115188075855871
150094635296999120
999999999999999999
505447028499293770
184884258895036415
665416609183179840
155568095557812223
437893890380859374
720575940379...

output:

6cad0f33-b1bd-3a3e-1a8d-c4af23adfcbf
OK
1083
1082 1081 1080 1079 1078 1077 1076 1075 1074 1073 1072 1071 1070 1069 1068 1067 1066 1065 1064 1063 1062 1061 1060 1059 1058 1057 1056 1055 1054 1053 1052 1051 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 10...

result:

points 0.61709401710