QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#412062 | #4252. Permutation | Rafi22 | 89.646154 | 44ms | 4064kb | C++14 | 2.0kb | 2024-05-16 01:56:38 | 2024-05-16 01:56:38 |
Judging History
answer
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define endl '\n'
#define st first
#define nd second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
using namespace std;
int inf=1000000007;
ll infl=1000000000000000007;
int mod=998244353;
bool is[1007];
vector<int>W[1007];
vector<int>calc(ll m)
{
if(m<=45) return W[m];
/* vector<int>t1=calc(m/2),T1;
for(auto x:W[m%2+1]) T1.pb(x+sz(t1)+sz(W[2]));
for(auto x:W[2]) T1.pb(x);
for(auto x:t1) T1.pb(x+sz(W[2]));*/
vector<int>t2=calc(m/5),T2;
for(auto x:W[m%5+1]) T2.pb(x+sz(t2)+sz(W[5]));
for(auto x:W[5]) T2.pb(x);
for(auto x:t2) T2.pb(x+sz(W[5]));
/* vector<int>t3=calc(m/11),T3;
for(auto x:W[m%11+1]) T3.pb(x+sz(t3)+sz(W[11]));
for(auto x:W[11]) T3.pb(x);
for(auto x:t3) T3.pb(x+sz(W[11]));*/
vector<int> res=T2;
// if(sz(T2)<sz(res)) res=T2;
// if(sz(T3)<sz(res)) res=T3;
return res;
}
vector<int>construct_permutation(ll m)
{
for(int n=1;n<=7;n++)
{
vector<int>p(n);
for(int i=0;i<n;i++) p[i]=i;
while(true)
{
vector<int>DP(n);
int act=1;
for(int i=0;i<n;i++)
{
DP[i]=1;
for(int j=0; j<i; j++) if(p[j]<p[i]) DP[i]+=DP[j];
act+=DP[i];
}
if(!is[act])
{
is[act]=1;
W[act]=p;
}
if(!next_permutation(all(p))) break;
}
}
return calc(m);
}
int cnt(vector<int>p)
{
int n=sz(p);
vector<int>DP(n);
int act=1;
for(int i=0;i<n;i++)
{
DP[i]=1;
for(int j=0; j<i; j++) if(p[j]<p[i]) DP[i]+=DP[j];
act+=DP[i];
}
return act;
}
/*
signed main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
vector<int>w=construct_permutation(123456);
for(auto x:w) cout<<x<<" ";
cout<<endl<<cnt(w);
return 0;
}*/
详细
Subtask #1:
score: 10
Accepted
Test #1:
score: 10
Accepted
time: 38ms
memory: 3772kb
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 0 2 1 4 1 3 2 0 3 0 1 2 4 1 0 3 2 4 0 2 3 1 5 1 3 4 2 0 4 0 1 3 2 5 1 2 4 3 0 5 0 2 4 3 1 5 1 0 3 4 2 4 0 1 2 3 5 1 2 3 4 0 5 0 2 1 4 3 6 1 2 5 0 4 3 5 0 1 3 4 2 6 1 0 3 5 4 2 6 0 2 4 5 3 1 6 1 2 4 0 5 3 5 0 1 2 4 3 6 1 2 0 4 5 3 6 0 ...
result:
ok
Subtask #2:
score: 79.6462
Acceptable Answer
Test #2:
score: 90
Accepted
time: 42ms
memory: 3772kb
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 31 29 30 1 2 0 27 28 4 5 3 25 26 24 7 8 6 22 23 21 10 11 9 19 20 13 14 12 15 16 18 17 29 27 28 26 1 2 0 25 4 5 3 23 24 7 8 6 10 11 9 22 21 13 14 12 16 15 18 17 20 19 28 1 2 0 26 27 25 4 5 3 7 8 6 23 24 22 10 11 9 21 20 13 14 12 16 15 18 19 17 23 22 1 2 0 20 21...
result:
ok
Test #3:
score: 90
Accepted
time: 39ms
memory: 3740kb
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 65 64 63 1 2 0 61 62 60 4 5 3 7 8 6 58 59 57 10 11 9 55 56 13 14 12 53 54 52 16 17 15 50 51 19 20 18 49 48 22 23 21 47 46 25 26 24 44 45 43 28 29 27 41 42 40 31 32 30 34 35 36 38 33 39 37 65 63 64 1 2 0 61 62 60 4 5 3 59 58 7 8 6 56 57 55 10 11 9 54 13 14 12 5...
result:
ok
Test #4:
score: 80
Acceptable Answer
time: 42ms
memory: 4016kb
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 118 117 116 1 2 0 115 114 4 5 3 112 113 111 7 8 6 110 109 10 11 9 108 107 13 14 12 16 17 15 105 106 104 19 20 18 102 103 22 23 21 101 25 26 24 99 100 98 28 29 27 31 32 30 97 96 34 35 33 95 37 38 36 93 94 40 41 39 91 92 90 43 44 42 46 47 45 88 89 49 50 48 86 87...
result:
points 0.88888888890
Test #5:
score: 90
Accepted
time: 43ms
memory: 3880kb
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 67 1 2 0 66 4 5 3 7 8 6 65 64 10 11 9 13 14 12 62 63 61 16 17 15 59 60 58 19 20 18 56 57 55 22 23 21 54 25 26 24 28 29 27 52 53 31 32 30 34 35 33 50 51 37 38 36 40 41 39 43 44 42 46 48 49 47 45 69 1 2 0 68 4 5 3 66 67 65 7 8 6 64 63 10 11 9 61 62 60 13 14 12 5...
result:
ok
Test #6:
score: 85
Acceptable Answer
time: 43ms
memory: 4052kb
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 87 86 85 1 2 0 83 84 82 4 5 3 81 80 7 8 6 79 10 11 9 78 77 13 14 12 76 75 16 17 15 74 19 20 18 22 23 21 72 73 71 25 26 24 28 29 27 31 32 30 34 35 33 70 37 38 36 69 40 41 39 68 67 43 44 42 46 47 45 65 66 49 50 48 64 63 52 53 51 62 55 56 54 58 59 60 61 57 94 93 ...
result:
points 0.94444444440
Test #7:
score: 79.8615
Acceptable Answer
time: 43ms
memory: 3788kb
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 102 101 1 2 0 99 100 4 5 3 97 98 96 7 8 6 95 10 11 9 13 14 12 94 16 17 15 92 93 91 19 20 18 90 89 22 23 21 87 88 25 26 24 86 28 29 27 85 84 31 32 30 34 35 33 82 83 81 37 38 36 40 41 39 80 43 44 42 78 79 77 46 47 45 76 75 49 50 48 74 52 53 51 73 55 56 54 71 72 ...
result:
points 0.88735042740
Test #8:
score: 80
Acceptable Answer
time: 43ms
memory: 3816kb
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 118 116 117 1 2 0 115 114 4 5 3 112 113 111 7 8 6 110 109 10 11 9 108 107 13 14 12 16 17 15 105 106 104 19 20 18 102 103 22 23 21 101 25 26 24 99 100 98 28 29 27 31 32 30 97 96 34 35 33 95 37 38 36 93 94 40 41 39 91 92 90 43 44 42 46 47 45 88 89 49 50 48 86 87...
result:
points 0.88888888890
Test #9:
score: 79.6769
Acceptable Answer
time: 43ms
memory: 3852kb
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 134 133 1 2 0 4 5 3 132 7 8 6 130 131 129 10 11 9 127 128 126 13 14 12 124 125 123 16 17 15 121 122 120 19 20 18 118 119 117 22 23 21 115 116 114 25 26 24 112 113 111 28 29 27 109 110 108 31 32 30 106 107 105 34 35 33 103 104 102 37 38 36 100 101 99 40 41 39 9...
result:
points 0.88529914530
Test #10:
score: 79.9692
Acceptable Answer
time: 43ms
memory: 3752kb
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 119 117 118 1 2 0 115 116 114 4 5 3 112 113 111 7 8 6 110 10 11 9 109 13 14 12 108 16 17 15 106 107 105 19 20 18 103 104 22 23 21 25 26 24 101 102 100 28 29 27 98 99 31 32 30 97 34 35 33 95 96 94 37 38 36 92 93 91 40 41 39 90 89 43 44 42 88 46 47 45 86 87 85 4...
result:
points 0.88854700850
Test #11:
score: 79.9846
Acceptable Answer
time: 44ms
memory: 3748kb
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 97 1 2 0 95 96 4 5 3 7 8 6 94 93 10 11 9 92 91 13 14 12 16 17 15 89 90 88 19 20 18 87 86 22 23 21 85 25 26 24 28 29 27 84 31 32 30 83 34 35 33 37 38 36 81 82 40 41 39 80 79 43 44 42 78 77 46 47 45 76 75 49 50 48 73 74 72 52 53 51 71 55 56 54 58 59 57 69 70 61 ...
result:
points 0.88871794870
Test #12:
score: 79.6462
Acceptable Answer
time: 43ms
memory: 4064kb
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 114 113 112 1 2 0 111 110 4 5 3 108 109 107 7 8 6 105 106 10 11 9 13 14 12 103 104 102 16 17 15 100 101 19 20 18 98 99 97 22 23 21 25 26 24 96 28 29 27 94 95 31 32 30 93 92 34 35 33 90 91 37 38 36 40 41 39 43 44 42 88 89 46 47 45 49 50 48 87 52 53 51 85 86 84 ...
result:
points 0.8849572650