QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#106284 | #4252. Permutation | fzj2007 | 100 ✓ | 2ms | 3652kb | C++20 | 627b | 2023-05-17 08:58:53 | 2023-05-17 08:58:54 |
Judging History
answer
#include<bits/stdc++.h>
#include "perm.h"
using namespace std;
vector<int> construct_permutation(long long k){
vector<int> val(65),flag(65);
int n=__lg(k),id=1,p1=-1,p2=-1;
for(int i=n-1;i>=0;i--){
if(k>>i&1){
if(i&&(k>>(i-1)&1)&&p1!=-1&&p2!=-1){
val[p1]--,val[p2]--,val[n-i+1]=val[p2]+1,flag[n-i+1]=1;
i--,id--;
}else{
val[n-i]=--id,flag[n-i]=1;
p2=p1,p1=n-i;
}
}
}
vector<int> res;
for(int i=1;i<=n;i++){
res.emplace_back(i);
if(flag[i]) res.emplace_back(val[i]);
}
int minn=2e9;
for(auto v:res) minn=min(minn,v);
for(auto &v:res) v-=minn;
return res;
}
详细
Subtask #1:
score: 10
Accepted
Test #1:
score: 10
Accepted
time: 0ms
memory: 3584kb
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 1 2 0 3 1 0 2 4 2 1 3 0 3 0 1 2 4 1 2 3 0 4 1 2 0 3 5 2 3 1 4 0 4 1 0 2 3 5 2 1 3 4 0 5 2 1 3 0 4 6 3 2 4 1 5 0 4 0 1 2 3 5 1 2 3 4 0 5 1 2 3 0 4 6 2 3 4 1 5 0 5 1 2 0 3 4 6 2 3 1 4 5 0 6 2 3 1 4 0 5 7 3 4 2 5 1 6 0 5 1 0 2 3 4 6 2 1 3 4 5 0 ...
result:
ok
Subtask #2:
score: 90
Accepted
Test #2:
score: 90
Accepted
time: 2ms
memory: 3608kb
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 21 6 7 8 5 9 3 10 2 11 12 13 14 15 16 4 17 1 18 19 20 0 22 6 7 2 8 9 10 1 11 12 5 13 14 15 4 16 17 18 19 3 20 21 0 21 6 7 4 8 3 9 10 5 11 2 12 13 14 15 16 17 18 1 19 20 0 20 6 5 7 8 9 10 4 11 1 12 13 14 0 15 16 17 3 18 19 2 16 3 2 4 1 5 0 6 7 8 9 10 11 12 13 1...
result:
ok
Test #3:
score: 90
Accepted
time: 2ms
memory: 3576kb
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 46 16 1 17 0 18 19 15 20 21 14 22 23 13 24 25 12 26 27 11 28 29 10 30 31 9 32 33 8 34 35 7 36 37 6 38 39 5 40 41 4 42 43 3 44 45 2 45 16 2 17 1 18 19 15 20 21 14 22 23 13 24 25 12 26 27 11 28 29 10 30 31 9 32 33 8 34 35 7 36 37 6 38 39 5 40 41 4 42 43 3 44 0 4...
result:
ok
Test #4:
score: 90
Accepted
time: 0ms
memory: 3612kb
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 88 30 1 31 0 32 33 29 34 35 28 36 37 27 38 39 26 40 41 25 42 43 24 44 45 23 46 47 22 48 49 21 50 51 20 52 53 19 54 55 18 56 57 17 58 59 16 60 61 15 62 63 14 64 65 13 66 67 12 68 69 11 70 71 10 72 73 9 74 75 8 76 77 7 78 79 6 80 81 5 82 83 4 84 85 3 86 87 2 87 ...
result:
ok
Test #5:
score: 90
Accepted
time: 2ms
memory: 3616kb
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 53 15 16 17 14 18 13 19 12 20 21 22 10 23 24 9 25 26 27 11 28 29 30 8 31 32 5 33 34 2 35 36 37 38 7 39 40 6 41 42 43 44 1 45 46 47 4 48 49 3 50 51 52 0 50 13 14 9 15 8 16 17 18 12 19 20 11 21 22 10 23 7 24 25 6 26 27 5 28 29 30 3 31 32 33 34 2 35 36 37 38 39 4...
result:
ok
Test #6:
score: 90
Accepted
time: 0ms
memory: 3624kb
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 60 12 13 14 11 15 16 8 17 5 18 19 20 21 22 23 10 24 25 26 27 28 29 30 9 31 32 33 34 35 3 36 37 38 7 39 40 41 42 6 43 44 2 45 46 47 4 48 49 50 51 52 53 54 55 56 1 57 58 59 0 65 16 17 18 19 20 21 22 15 23 14 24 25 13 26 27 28 29 30 31 11 32 33 10 34 35 36 12 37 ...
result:
ok
Test #7:
score: 90
Accepted
time: 1ms
memory: 3636kb
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 72 19 20 21 22 18 23 24 16 25 15 26 27 28 17 29 30 31 14 32 33 34 35 36 10 37 38 39 9 40 41 42 13 43 44 12 45 46 47 11 48 8 49 50 51 52 53 5 54 55 4 56 57 58 59 7 60 61 6 62 2 63 64 1 65 66 67 68 3 69 70 71 0 81 22 23 19 24 18 25 26 27 28 29 21 30 31 32 20 33 ...
result:
ok
Test #8:
score: 90
Accepted
time: 1ms
memory: 3588kb
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 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 ...
result:
ok
Test #9:
score: 90
Accepted
time: 2ms
memory: 3592kb
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 83 24 22 25 26 21 27 28 23 29 18 30 31 32 33 34 35 15 36 37 38 20 39 40 41 19 42 43 14 44 45 46 17 47 48 49 50 16 51 12 52 53 5 54 55 56 57 13 58 3 59 60 61 11 62 63 64 65 66 10 67 68 9 69 70 8 71 72 7 73 74 6 75 2 76 77 78 79 4 80 1 81 82 0 82 23 21 24 25 20 ...
result:
ok
Test #10:
score: 90
Accepted
time: 2ms
memory: 3652kb
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 77 19 20 21 18 22 23 16 24 25 26 27 28 29 30 31 32 33 34 15 35 36 37 38 17 39 40 14 41 42 13 43 44 6 45 46 47 48 5 49 50 51 52 12 53 54 11 55 56 57 10 58 59 60 9 61 62 63 8 64 65 7 66 3 67 68 2 69 70 71 72 73 4 74 1 75 76 0 79 21 22 23 24 25 18 26 17 27 28 29 ...
result:
ok
Test #11:
score: 90
Accepted
time: 2ms
memory: 3636kb
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 66 13 14 11 15 16 17 18 19 20 21 22 23 24 25 9 26 27 28 12 29 7 30 31 32 10 33 34 35 36 37 38 5 39 40 41 42 43 44 8 45 4 46 47 48 49 6 50 51 52 53 2 54 55 1 56 57 58 59 3 60 61 0 62 63 64 65 58 17 16 18 19 13 20 10 21 22 23 15 24 25 14 26 27 9 28 29 30 31 12 3...
result:
ok
Test #12:
score: 90
Accepted
time: 1ms
memory: 3648kb
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 82 24 19 25 26 27 28 18 29 30 23 31 32 22 33 34 21 35 36 37 20 38 16 39 40 14 41 42 43 17 44 45 13 46 47 48 49 15 50 12 51 52 11 53 54 55 56 9 57 58 8 59 60 61 10 62 63 7 64 65 6 66 67 5 68 69 3 70 71 2 72 73 74 75 76 4 77 1 78 79 80 0 81 87 30 2 31 1 32 33 29...
result:
ok
Extra Test:
score: 0
Extra Test Passed