QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#150545 | #4923. 整数 | yyyyxh | 5 | 1ms | 3328kb | C++17 | 1003b | 2023-08-25 20:22:46 | 2023-08-25 20:22:48 |
answer
#include "integer.h"
#include <vector>
#include <cctype>
#include <random>
#include <algorithm>
using namespace std;
mt19937 rng(random_device{}());
// mt19937 rng(2007329);
typedef vector<int> vi;
int popc;
int op(int x){
// printf("Op %d\n",x);
int tmp=operate(x);
swap(popc,tmp);
return popc-tmp;
}
vi findPermutation(int n){
vi p(n),res(n);popc=0;
iota(p.begin(),p.end(),0);
shuffle(p.begin(),p.end(),rng);
for(int i=0;i<n;++i) op(i);
vi det;
int cnt=0;
while(!p.empty()){
++cnt;
vi tmp;
bool fir=1;
int las=n;
vi ndet;
for(int x:p){
int t=op(x);
if(t==1) tmp.emplace_back(x);
else{
res[x]=las-1+t;
if(fir) res[x]+=__builtin_ctz(cnt),fir=0;
las=res[x];
// printf("Deter %d->%d\n",x,res[x]);
ndet.emplace_back(x);
}
}
if(int(ndet.size()+det.size())==n) break;
for(int x:det) op(x);
for(int x:ndet) det.emplace_back(x);
if(!ndet.empty()) op(ndet.back());
p.swap(tmp);
}
return res;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 5
Accepted
Test #1:
score: 5
Accepted
time: 0ms
memory: 3092kb
input:
1 0
output:
68F82AC1898AF4BFACDCBB49543233A61773093A OK Passed using 2 operation(s): scoring 1.000 1.0000000000
result:
ok Passed using 2 operation(s): scoring 1.000
Test #2:
score: 5
Accepted
time: 1ms
memory: 3104kb
input:
3 0 2 1
output:
68F82AC1898AF4BFACDCBB49543233A61773093A OK Passed using 6 operation(s): scoring 1.000 1.0000000000
result:
ok Passed using 6 operation(s): scoring 1.000
Test #3:
score: 5
Accepted
time: 1ms
memory: 3248kb
input:
3 0 2 1
output:
68F82AC1898AF4BFACDCBB49543233A61773093A OK Passed using 15 operation(s): scoring 1.000 1.0000000000
result:
ok Passed using 15 operation(s): scoring 1.000
Test #4:
score: 5
Accepted
time: 0ms
memory: 3204kb
input:
10 0 2 8 9 1 5 6 3 4 7
output:
68F82AC1898AF4BFACDCBB49543233A61773093A OK Passed using 1365 operation(s): scoring 1.000 1.0000000000
result:
ok Passed using 1365 operation(s): scoring 1.000
Test #5:
score: 5
Accepted
time: 1ms
memory: 3140kb
input:
10 1 8 3 2 6 0 7 9 5 4
output:
68F82AC1898AF4BFACDCBB49543233A61773093A OK Passed using 144 operation(s): scoring 1.000 1.0000000000
result:
ok Passed using 144 operation(s): scoring 1.000
Test #6:
score: 5
Accepted
time: 1ms
memory: 3168kb
input:
10 9 7 0 8 3 5 2 6 1 4
output:
68F82AC1898AF4BFACDCBB49543233A61773093A OK Passed using 1005 operation(s): scoring 1.000 1.0000000000
result:
ok Passed using 1005 operation(s): scoring 1.000
Test #7:
score: 5
Accepted
time: 1ms
memory: 3096kb
input:
10 0 1 2 3 4 5 6 7 8 9
output:
68F82AC1898AF4BFACDCBB49543233A61773093A OK Passed using 525 operation(s): scoring 1.000 1.0000000000
result:
ok Passed using 525 operation(s): scoring 1.000
Test #8:
score: 5
Accepted
time: 1ms
memory: 3092kb
input:
10 9 8 7 6 5 4 3 2 1 0
output:
68F82AC1898AF4BFACDCBB49543233A61773093A OK Passed using 306 operation(s): scoring 1.000 1.0000000000
result:
ok Passed using 306 operation(s): scoring 1.000
Test #9:
score: 5
Accepted
time: 1ms
memory: 3248kb
input:
2 0 1
output:
68F82AC1898AF4BFACDCBB49543233A61773093A OK Passed using 4 operation(s): scoring 1.000 1.0000000000
result:
ok Passed using 4 operation(s): scoring 1.000
Test #10:
score: 5
Accepted
time: 1ms
memory: 3196kb
input:
2 1 0
output:
68F82AC1898AF4BFACDCBB49543233A61773093A OK Passed using 4 operation(s): scoring 1.000 1.0000000000
result:
ok Passed using 4 operation(s): scoring 1.000
Test #11:
score: 5
Accepted
time: 1ms
memory: 3296kb
input:
4 2 3 0 1
output:
68F82AC1898AF4BFACDCBB49543233A61773093A OK Passed using 10 operation(s): scoring 1.000 1.0000000000
result:
ok Passed using 10 operation(s): scoring 1.000
Test #12:
score: 5
Accepted
time: 1ms
memory: 3132kb
input:
4 1 2 0 3
output:
68F82AC1898AF4BFACDCBB49543233A61773093A OK Passed using 11 operation(s): scoring 1.000 1.0000000000
result:
ok Passed using 11 operation(s): scoring 1.000
Test #13:
score: 5
Accepted
time: 1ms
memory: 3132kb
input:
4 1 3 0 2
output:
68F82AC1898AF4BFACDCBB49543233A61773093A OK Passed using 20 operation(s): scoring 1.000 1.0000000000
result:
ok Passed using 20 operation(s): scoring 1.000
Test #14:
score: 5
Accepted
time: 1ms
memory: 3252kb
input:
5 0 3 4 2 1
output:
68F82AC1898AF4BFACDCBB49543233A61773093A OK Passed using 13 operation(s): scoring 1.000 1.0000000000
result:
ok Passed using 13 operation(s): scoring 1.000
Test #15:
score: 5
Accepted
time: 1ms
memory: 3104kb
input:
5 0 2 3 4 1
output:
68F82AC1898AF4BFACDCBB49543233A61773093A OK Passed using 24 operation(s): scoring 1.000 1.0000000000
result:
ok Passed using 24 operation(s): scoring 1.000
Test #16:
score: 5
Accepted
time: 1ms
memory: 3300kb
input:
5 3 0 2 4 1
output:
68F82AC1898AF4BFACDCBB49543233A61773093A OK Passed using 53 operation(s): scoring 1.000 1.0000000000
result:
ok Passed using 53 operation(s): scoring 1.000
Test #17:
score: 5
Accepted
time: 0ms
memory: 3296kb
input:
5 1 4 3 2 0
output:
68F82AC1898AF4BFACDCBB49543233A61773093A OK Passed using 23 operation(s): scoring 1.000 1.0000000000
result:
ok Passed using 23 operation(s): scoring 1.000
Test #18:
score: 5
Accepted
time: 1ms
memory: 3204kb
input:
5 3 4 2 0 1
output:
68F82AC1898AF4BFACDCBB49543233A61773093A OK Passed using 64 operation(s): scoring 1.000 1.0000000000
result:
ok Passed using 64 operation(s): scoring 1.000
Test #19:
score: 5
Accepted
time: 1ms
memory: 3328kb
input:
5 0 1 2 3 4
output:
68F82AC1898AF4BFACDCBB49543233A61773093A OK Passed using 23 operation(s): scoring 1.000 1.0000000000
result:
ok Passed using 23 operation(s): scoring 1.000
Test #20:
score: 5
Accepted
time: 0ms
memory: 3164kb
input:
5 4 3 2 1 0
output:
68F82AC1898AF4BFACDCBB49543233A61773093A OK Passed using 74 operation(s): scoring 1.000 1.0000000000
result:
ok Passed using 74 operation(s): scoring 1.000
Test #21:
score: 5
Accepted
time: 1ms
memory: 3104kb
input:
6 2 4 5 3 1 0
output:
68F82AC1898AF4BFACDCBB49543233A61773093A OK Passed using 52 operation(s): scoring 1.000 1.0000000000
result:
ok Passed using 52 operation(s): scoring 1.000
Test #22:
score: 5
Accepted
time: 1ms
memory: 3096kb
input:
6 4 5 0 2 1 3
output:
68F82AC1898AF4BFACDCBB49543233A61773093A OK Passed using 16 operation(s): scoring 1.000 1.0000000000
result:
ok Passed using 16 operation(s): scoring 1.000
Test #23:
score: 5
Accepted
time: 0ms
memory: 3192kb
input:
6 5 0 2 3 1 4
output:
68F82AC1898AF4BFACDCBB49543233A61773093A OK Passed using 39 operation(s): scoring 1.000 1.0000000000
result:
ok Passed using 39 operation(s): scoring 1.000
Test #24:
score: 5
Accepted
time: 1ms
memory: 3160kb
input:
6 4 3 2 1 0 5
output:
68F82AC1898AF4BFACDCBB49543233A61773093A OK Passed using 40 operation(s): scoring 1.000 1.0000000000
result:
ok Passed using 40 operation(s): scoring 1.000
Test #25:
score: 5
Accepted
time: 1ms
memory: 3164kb
input:
6 0 1 2 3 4 5
output:
68F82AC1898AF4BFACDCBB49543233A61773093A OK Passed using 27 operation(s): scoring 1.000 1.0000000000
result:
ok Passed using 27 operation(s): scoring 1.000
Test #26:
score: 5
Accepted
time: 1ms
memory: 3100kb
input:
7 0 6 4 2 3 5 1
output:
68F82AC1898AF4BFACDCBB49543233A61773093A OK Passed using 173 operation(s): scoring 1.000 1.0000000000
result:
ok Passed using 173 operation(s): scoring 1.000
Test #27:
score: 5
Accepted
time: 1ms
memory: 3140kb
input:
7 3 0 5 4 1 6 2
output:
68F82AC1898AF4BFACDCBB49543233A61773093A OK Passed using 46 operation(s): scoring 1.000 1.0000000000
result:
ok Passed using 46 operation(s): scoring 1.000
Test #28:
score: 5
Accepted
time: 1ms
memory: 3128kb
input:
7 0 6 3 2 1 4 5
output:
68F82AC1898AF4BFACDCBB49543233A61773093A OK Passed using 33 operation(s): scoring 1.000 1.0000000000
result:
ok Passed using 33 operation(s): scoring 1.000
Test #29:
score: 5
Accepted
time: 0ms
memory: 3156kb
input:
7 0 1 2 3 4 5 6
output:
68F82AC1898AF4BFACDCBB49543233A61773093A OK Passed using 33 operation(s): scoring 1.000 1.0000000000
result:
ok Passed using 33 operation(s): scoring 1.000
Test #30:
score: 5
Accepted
time: 1ms
memory: 3092kb
input:
7 6 5 4 3 2 1 0
output:
68F82AC1898AF4BFACDCBB49543233A61773093A OK Passed using 18 operation(s): scoring 1.000 1.0000000000
result:
ok Passed using 18 operation(s): scoring 1.000
Test #31:
score: 5
Accepted
time: 1ms
memory: 3248kb
input:
8 0 1 2 3 4 5 6 7
output:
68F82AC1898AF4BFACDCBB49543233A61773093A OK Passed using 68 operation(s): scoring 1.000 1.0000000000
result:
ok Passed using 68 operation(s): scoring 1.000
Test #32:
score: 5
Accepted
time: 0ms
memory: 3100kb
input:
9 0 1 2 3 4 5 6 7 8
output:
68F82AC1898AF4BFACDCBB49543233A61773093A OK Passed using 529 operation(s): scoring 1.000 1.0000000000
result:
ok Passed using 529 operation(s): scoring 1.000
Test #33:
score: 5
Accepted
time: 1ms
memory: 3196kb
input:
8 7 6 5 4 3 2 1 0
output:
68F82AC1898AF4BFACDCBB49543233A61773093A OK Passed using 100 operation(s): scoring 1.000 1.0000000000
result:
ok Passed using 100 operation(s): scoring 1.000
Test #34:
score: 5
Accepted
time: 1ms
memory: 3192kb
input:
9 8 7 6 5 4 3 2 1 0
output:
68F82AC1898AF4BFACDCBB49543233A61773093A OK Passed using 1481 operation(s): scoring 1.000 1.0000000000
result:
ok Passed using 1481 operation(s): scoring 1.000
Test #35:
score: 5
Accepted
time: 1ms
memory: 3096kb
input:
8 5 3 2 1 6 7 0 4
output:
68F82AC1898AF4BFACDCBB49543233A61773093A OK Passed using 629 operation(s): scoring 1.000 1.0000000000
result:
ok Passed using 629 operation(s): scoring 1.000
Test #36:
score: 5
Accepted
time: 1ms
memory: 3200kb
input:
8 6 0 3 4 2 7 1 5
output:
68F82AC1898AF4BFACDCBB49543233A61773093A OK Passed using 293 operation(s): scoring 1.000 1.0000000000
result:
ok Passed using 293 operation(s): scoring 1.000
Test #37:
score: 5
Accepted
time: 1ms
memory: 3292kb
input:
9 2 5 4 8 6 0 3 1 7
output:
68F82AC1898AF4BFACDCBB49543233A61773093A OK Passed using 328 operation(s): scoring 1.000 1.0000000000
result:
ok Passed using 328 operation(s): scoring 1.000
Test #38:
score: 5
Accepted
time: 0ms
memory: 3152kb
input:
9 6 0 4 2 7 3 5 8 1
output:
68F82AC1898AF4BFACDCBB49543233A61773093A OK Passed using 401 operation(s): scoring 1.000 1.0000000000
result:
ok Passed using 401 operation(s): scoring 1.000
Test #39:
score: 5
Accepted
time: 0ms
memory: 3248kb
input:
9 2 6 4 0 5 7 1 3 8
output:
68F82AC1898AF4BFACDCBB49543233A61773093A OK Passed using 202 operation(s): scoring 1.000 1.0000000000
result:
ok Passed using 202 operation(s): scoring 1.000
Test #40:
score: 5
Accepted
time: 0ms
memory: 3164kb
input:
10 0 7 2 8 5 9 6 3 4 1
output:
68F82AC1898AF4BFACDCBB49543233A61773093A OK Passed using 366 operation(s): scoring 1.000 1.0000000000
result:
ok Passed using 366 operation(s): scoring 1.000
Test #41:
score: 5
Accepted
time: 0ms
memory: 3168kb
input:
10 0 9 1 8 6 7 4 3 5 2
output:
68F82AC1898AF4BFACDCBB49543233A61773093A OK Passed using 245 operation(s): scoring 1.000 1.0000000000
result:
ok Passed using 245 operation(s): scoring 1.000
Test #42:
score: 5
Accepted
time: 0ms
memory: 3208kb
input:
10 0 7 4 5 8 6 1 3 9 2
output:
68F82AC1898AF4BFACDCBB49543233A61773093A OK Passed using 704 operation(s): scoring 1.000 1.0000000000
result:
ok Passed using 704 operation(s): scoring 1.000
Subtask #2:
score: 0
Time Limit Exceeded
Dependency #1:
100%
Accepted
Test #43:
score: 0
Time Limit Exceeded
input:
70 44 64 19 37 17 65 8 53 6 36 3 30 35 24 34 60 29 56 18 45 1 51 13 23 41 28 49 50 9 21 54 68 27 46 32 57 43 25 67 63 52 47 15 20 58 16 42 39 11 7 4 31 38 69 26 33 2 59 40 66 55 22 0 12 10 48 62 14 5 61
output:
result:
Subtask #3:
score: 0
Skipped
Dependency #2:
0%
Subtask #4:
score: 0
Time Limit Exceeded
Test #84:
score: 0
Time Limit Exceeded
input:
5000 0 4022 1149 1576 2995 1809 3803 4188 1400 1251 4042 2830 766 4811 1622 4002 4474 1003 1152 130 4794 1902 1292 968 4673 3459 1795 3812 531 2335 1660 4968 3632 4047 353 4448 2515 1581 4259 1389 3628 3760 1381 2527 2353 4323 2807 386 1731 1973 1209 1982 232 747 2904 897 4375 2921 3384 457 1050 936...
output:
result:
Subtask #5:
score: 0
Skipped
Dependency #3:
0%