QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#150543#4923. 整数yyyyxh10 7ms3500kbC++171002b2023-08-25 20:21:412023-08-25 20:21:44

Judging History

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

  • [2023-08-25 20:21:44]
  • 评测
  • 测评结果:10
  • 用时:7ms
  • 内存:3500kb
  • [2023-08-25 20:21:41]
  • 提交

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.back()) op(ndet.back());
		p.swap(tmp);
	}
	return res;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Runtime Error

Test #1:

score: 5
Accepted
time: 1ms
memory: 3140kb

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: 0ms
memory: 3292kb

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: 3064kb

input:

3
0 2 1

output:

68F82AC1898AF4BFACDCBB49543233A61773093A
OK
Passed using 11 operation(s): scoring 1.000
1.0000000000

result:

ok Passed using 11 operation(s): scoring 1.000

Test #4:

score: 5
Accepted
time: 1ms
memory: 3208kb

input:

10
0 2 8 9 1 5 6 3 4 7

output:

68F82AC1898AF4BFACDCBB49543233A61773093A
OK
Passed using 42 operation(s): scoring 1.000
1.0000000000

result:

ok Passed using 42 operation(s): scoring 1.000

Test #5:

score: 5
Accepted
time: 1ms
memory: 3208kb

input:

10
1 8 3 2 6 0 7 9 5 4

output:

68F82AC1898AF4BFACDCBB49543233A61773093A
OK
Passed using 71 operation(s): scoring 1.000
1.0000000000

result:

ok Passed using 71 operation(s): scoring 1.000

Test #6:

score: 5
Accepted
time: 0ms
memory: 3248kb

input:

10
9 7 0 8 3 5 2 6 1 4

output:

68F82AC1898AF4BFACDCBB49543233A61773093A
OK
Passed using 42 operation(s): scoring 1.000
1.0000000000

result:

ok Passed using 42 operation(s): scoring 1.000

Test #7:

score: 5
Accepted
time: 1ms
memory: 3204kb

input:

10
0 1 2 3 4 5 6 7 8 9

output:

68F82AC1898AF4BFACDCBB49543233A61773093A
OK
Passed using 52 operation(s): scoring 1.000
1.0000000000

result:

ok Passed using 52 operation(s): scoring 1.000

Test #8:

score: 5
Accepted
time: 1ms
memory: 3328kb

input:

10
9 8 7 6 5 4 3 2 1 0

output:

68F82AC1898AF4BFACDCBB49543233A61773093A
OK
Passed using 42 operation(s): scoring 1.000
1.0000000000

result:

ok Passed using 42 operation(s): scoring 1.000

Test #9:

score: 5
Accepted
time: 1ms
memory: 3140kb

input:

2
0 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 #10:

score: 5
Accepted
time: 1ms
memory: 3248kb

input:

2
1 0

output:

68F82AC1898AF4BFACDCBB49543233A61773093A
OK
Passed using 5 operation(s): scoring 1.000
1.0000000000

result:

ok Passed using 5 operation(s): scoring 1.000

Test #11:

score: 5
Accepted
time: 1ms
memory: 3248kb

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: 0ms
memory: 3132kb

input:

4
1 2 0 3

output:

68F82AC1898AF4BFACDCBB49543233A61773093A
OK
Passed using 9 operation(s): scoring 1.000
1.0000000000

result:

ok Passed using 9 operation(s): scoring 1.000

Test #13:

score: 5
Accepted
time: 0ms
memory: 3312kb

input:

4
1 3 0 2

output:

68F82AC1898AF4BFACDCBB49543233A61773093A
OK
Passed using 11 operation(s): scoring 1.000
1.0000000000

result:

ok Passed using 11 operation(s): scoring 1.000

Test #14:

score: 5
Accepted
time: 1ms
memory: 3304kb

input:

5
0 3 4 2 1

output:

68F82AC1898AF4BFACDCBB49543233A61773093A
OK
Passed using 17 operation(s): scoring 1.000
1.0000000000

result:

ok Passed using 17 operation(s): scoring 1.000

Test #15:

score: 5
Accepted
time: 1ms
memory: 3252kb

input:

5
0 2 3 4 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 #16:

score: 5
Accepted
time: 1ms
memory: 3328kb

input:

5
3 0 2 4 1

output:

68F82AC1898AF4BFACDCBB49543233A61773093A
OK
Passed using 16 operation(s): scoring 1.000
1.0000000000

result:

ok Passed using 16 operation(s): scoring 1.000

Test #17:

score: 5
Accepted
time: 1ms
memory: 3320kb

input:

5
1 4 3 2 0

output:

68F82AC1898AF4BFACDCBB49543233A61773093A
OK
Passed using 16 operation(s): scoring 1.000
1.0000000000

result:

ok Passed using 16 operation(s): scoring 1.000

Test #18:

score: 5
Accepted
time: 1ms
memory: 3308kb

input:

5
3 4 2 0 1

output:

68F82AC1898AF4BFACDCBB49543233A61773093A
OK
Passed using 21 operation(s): scoring 1.000
1.0000000000

result:

ok Passed using 21 operation(s): scoring 1.000

Test #19:

score: 5
Accepted
time: 1ms
memory: 3300kb

input:

5
0 1 2 3 4

output:

68F82AC1898AF4BFACDCBB49543233A61773093A
OK
Passed using 13 operation(s): scoring 1.000
1.0000000000

result:

ok Passed using 13 operation(s): scoring 1.000

Test #20:

score: 5
Accepted
time: 1ms
memory: 3152kb

input:

5
4 3 2 1 0

output:

68F82AC1898AF4BFACDCBB49543233A61773093A
OK
Passed using 21 operation(s): scoring 1.000
1.0000000000

result:

ok Passed using 21 operation(s): scoring 1.000

Test #21:

score: 0
Runtime Error

input:

6
2 4 5 3 1 0

output:


result:


Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Skipped

Dependency #2:

0%

Subtask #4:

score: 10
Accepted

Test #84:

score: 10
Accepted
time: 4ms
memory: 3484kb

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:

68F82AC1898AF4BFACDCBB49543233A61773093A
OK
Passed using 670004 operation(s): scoring 1.000
1.0000000000

result:

ok Passed using 670004 operation(s): scoring 1.000

Test #85:

score: 10
Accepted
time: 4ms
memory: 3372kb

input:

5000
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 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 91 92 93 94 95 96 97 98 99 100 1...

output:

68F82AC1898AF4BFACDCBB49543233A61773093A
OK
Passed using 675002 operation(s): scoring 1.000
1.0000000000

result:

ok Passed using 675002 operation(s): scoring 1.000

Test #86:

score: 10
Accepted
time: 2ms
memory: 3496kb

input:

5000
0 4999 4998 4997 4996 4995 4994 4993 4992 4991 4990 4989 4988 4987 4986 4985 4984 4983 4982 4981 4980 4979 4978 4977 4976 4975 4974 4973 4972 4971 4970 4969 4968 4967 4966 4965 4964 4963 4962 4961 4960 4959 4958 4957 4956 4955 4954 4953 4952 4951 4950 4949 4948 4947 4946 4945 4944 4943 4942 494...

output:

68F82AC1898AF4BFACDCBB49543233A61773093A
OK
Passed using 700002 operation(s): scoring 1.000
1.0000000000

result:

ok Passed using 700002 operation(s): scoring 1.000

Test #87:

score: 10
Accepted
time: 2ms
memory: 3368kb

input:

5000
0 206 472 204 527 84 134 30 801 61 100 138 695 340 228 259 31 157 218 266 352 231 500 80 362 99 189 77 168 344 475 223 111 626 161 282 96 368 434 91 165 230 479 621 215 269 37 116 433 425 166 182 505 22 553 40 526 14 125 65 17 524 58 252 57 673 90 508 365 42 88 72 25 565 609 150 651 200 86 546 ...

output:

68F82AC1898AF4BFACDCBB49543233A61773093A
OK
Passed using 670003 operation(s): scoring 1.000
1.0000000000

result:

ok Passed using 670003 operation(s): scoring 1.000

Test #88:

score: 10
Accepted
time: 4ms
memory: 3432kb

input:

5000
0 1918 435 1484 391 600 3475 951 1459 2753 516 1512 1121 1064 893 1355 1675 114 909 550 566 548 1081 933 157 78 789 264 230 1010 61 57 514 1016 118 964 925 1199 915 226 1019 505 408 997 773 547 35 1229 286 3645 1876 1210 487 1209 182 1424 859 611 1138 1038 719 532 546 2514 1607 1230 1296 2271 7...

output:

68F82AC1898AF4BFACDCBB49543233A61773093A
OK
Passed using 675003 operation(s): scoring 1.000
1.0000000000

result:

ok Passed using 675003 operation(s): scoring 1.000

Test #89:

score: 10
Accepted
time: 4ms
memory: 3312kb

input:

5000
0 2684 3226 1101 1223 1375 2678 800 656 582 494 3141 326 4523 2100 301 2233 1802 2722 748 4318 3192 842 2049 185 1882 779 925 725 3950 4766 3570 3964 2297 4513 1147 4732 889 3925 4508 1066 4444 3340 3216 2739 3806 2457 2903 4350 2376 1595 4257 3921 4618 3573 1564 1825 4770 1010 2662 214 961 709...

output:

68F82AC1898AF4BFACDCBB49543233A61773093A
OK
Passed using 680002 operation(s): scoring 1.000
1.0000000000

result:

ok Passed using 680002 operation(s): scoring 1.000

Test #90:

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

input:

1004
0 94 823 206 67 75 150 792 825 803 790 176 433 457 147 362 622 266 445 467 596 251 530 778 122 582 2 992 789 409 946 555 834 47 11 488 30 570 830 366 874 828 452 900 766 371 620 141 98 334 262 952 279 311 9 172 363 795 203 401 257 137 181 323 48 642 886 244 458 945 890 866 66 249 835 722 551 94...

output:

68F82AC1898AF4BFACDCBB49543233A61773093A
OK
Passed using 58234 operation(s): scoring 1.000
1.0000000000

result:

ok Passed using 58234 operation(s): scoring 1.000

Test #91:

score: 10
Accepted
time: 2ms
memory: 3212kb

input:

2003
0 1419 488 1442 1638 1036 121 530 1101 158 1622 1743 852 1556 739 1201 545 1969 1753 1140 1230 1923 1382 1792 1258 1967 1495 538 1244 644 1680 1811 464 1388 877 1355 911 1675 759 624 341 1100 796 1886 1568 1487 1236 605 1316 1337 315 689 1922 1227 1120 435 1260 1213 1152 1905 956 925 1542 1064 ...

output:

68F82AC1898AF4BFACDCBB49543233A61773093A
OK
Passed using 168254 operation(s): scoring 1.000
1.0000000000

result:

ok Passed using 168254 operation(s): scoring 1.000

Test #92:

score: 10
Accepted
time: 2ms
memory: 3168kb

input:

3002
0 167 2914 131 2383 2275 1603 2009 2637 2085 1605 215 1119 1032 1352 799 2681 2622 1876 1400 202 931 2996 800 1958 108 263 2490 1812 2940 1860 508 286 1042 299 2581 1223 594 2414 2256 1120 1604 1833 2967 572 2807 1554 1048 1151 350 1830 2593 823 2582 1600 409 1382 2276 1698 281 1863 1208 1894 2...

output:

68F82AC1898AF4BFACDCBB49543233A61773093A
OK
Passed using 321216 operation(s): scoring 1.000
1.0000000000

result:

ok Passed using 321216 operation(s): scoring 1.000

Test #93:

score: 10
Accepted
time: 3ms
memory: 3208kb

input:

4001
0 3751 2983 1519 958 3118 2231 3295 1730 1660 264 3509 3252 2342 3573 977 422 642 1551 2058 1177 1704 1502 516 1685 244 2752 1789 119 1274 509 1316 1569 2621 3083 974 1895 1865 1057 1015 779 1082 3915 3889 124 160 2433 338 3048 1295 592 708 1665 2895 3806 3868 3183 2357 3390 1449 1811 1448 3578...

output:

68F82AC1898AF4BFACDCBB49543233A61773093A
OK
Passed using 480122 operation(s): scoring 1.000
1.0000000000

result:

ok Passed using 480122 operation(s): scoring 1.000

Test #94:

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

input:

10
0 3 2 1 5 4 6 9 8 7

output:

68F82AC1898AF4BFACDCBB49543233A61773093A
OK
Passed using 42 operation(s): scoring 1.000
1.0000000000

result:

ok Passed using 42 operation(s): scoring 1.000

Test #95:

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

input:

10
0 8 1 3 6 9 5 2 4 7

output:

68F82AC1898AF4BFACDCBB49543233A61773093A
OK
Passed using 42 operation(s): scoring 1.000
1.0000000000

result:

ok Passed using 42 operation(s): scoring 1.000

Test #96:

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

input:

10
0 8 4 9 6 2 1 5 3 7

output:

68F82AC1898AF4BFACDCBB49543233A61773093A
OK
Passed using 42 operation(s): scoring 1.000
1.0000000000

result:

ok Passed using 42 operation(s): scoring 1.000

Test #97:

score: 10
Accepted
time: 0ms
memory: 3140kb

input:

70
0 35 22 19 46 16 44 39 21 40 34 20 24 56 60 61 5 43 38 4 25 13 41 54 7 29 42 65 8 12 55 52 11 18 67 50 36 10 49 59 51 1 9 62 23 33 37 69 3 45 66 28 30 58 17 31 64 48 26 27 47 57 53 68 2 6 32 63 14 15

output:

68F82AC1898AF4BFACDCBB49543233A61773093A
OK
Passed using 845 operation(s): scoring 1.000
1.0000000000

result:

ok Passed using 845 operation(s): scoring 1.000

Test #98:

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

input:

900
0 899 898 897 896 895 894 893 892 891 890 889 888 887 886 885 884 883 882 881 880 879 878 877 876 875 874 873 872 871 870 869 868 867 866 865 864 863 862 861 860 859 858 857 856 855 854 853 852 851 850 849 848 847 846 845 844 843 842 841 840 839 838 837 836 835 834 833 832 831 830 829 828 827 82...

output:

68F82AC1898AF4BFACDCBB49543233A61773093A
OK
Passed using 45903 operation(s): scoring 1.000
1.0000000000

result:

ok Passed using 45903 operation(s): scoring 1.000

Test #99:

score: 10
Accepted
time: 0ms
memory: 3296kb

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 #100:

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

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 #101:

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

input:

3
0 1 2

output:

68F82AC1898AF4BFACDCBB49543233A61773093A
OK
Passed using 8 operation(s): scoring 1.000
1.0000000000

result:

ok Passed using 8 operation(s): scoring 1.000

Test #102:

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

input:

4
0 3 2 1

output:

68F82AC1898AF4BFACDCBB49543233A61773093A
OK
Passed using 14 operation(s): scoring 1.000
1.0000000000

result:

ok Passed using 14 operation(s): scoring 1.000

Test #103:

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

input:

5
0 1 2 3 4

output:

68F82AC1898AF4BFACDCBB49543233A61773093A
OK
Passed using 17 operation(s): scoring 1.000
1.0000000000

result:

ok Passed using 17 operation(s): scoring 1.000

Test #104:

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

input:

10
0 1 2 3 4 5 6 7 8 9

output:

68F82AC1898AF4BFACDCBB49543233A61773093A
OK
Passed using 42 operation(s): scoring 1.000
1.0000000000

result:

ok Passed using 42 operation(s): scoring 1.000

Test #105:

score: 10
Accepted
time: 0ms
memory: 3212kb

input:

49
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

output:

68F82AC1898AF4BFACDCBB49543233A61773093A
OK
Passed using 590 operation(s): scoring 1.000
1.0000000000

result:

ok Passed using 590 operation(s): scoring 1.000

Test #106:

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

input:

123
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 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 91 92 93 94 95 96 97 98 99 100 10...

output:

68F82AC1898AF4BFACDCBB49543233A61773093A
OK
Passed using 2216 operation(s): scoring 1.000
1.0000000000

result:

ok Passed using 2216 operation(s): scoring 1.000

Test #107:

score: 10
Accepted
time: 7ms
memory: 3304kb

input:

4992
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 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 91 92 93 94 95 96 97 98 99 100 1...

output:

68F82AC1898AF4BFACDCBB49543233A61773093A
OK
Passed using 703875 operation(s): scoring 1.000
1.0000000000

result:

ok Passed using 703875 operation(s): scoring 1.000

Test #108:

score: 10
Accepted
time: 2ms
memory: 3500kb

input:

4999
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 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 91 92 93 94 95 96 97 98 99 100 1...

output:

68F82AC1898AF4BFACDCBB49543233A61773093A
OK
Passed using 679866 operation(s): scoring 1.000
1.0000000000

result:

ok Passed using 679866 operation(s): scoring 1.000

Test #109:

score: 10
Accepted
time: 2ms
memory: 3376kb

input:

4929
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 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 91 92 93 94 95 96 97 98 99 100 1...

output:

68F82AC1898AF4BFACDCBB49543233A61773093A
OK
Passed using 675275 operation(s): scoring 1.000
1.0000000000

result:

ok Passed using 675275 operation(s): scoring 1.000

Subtask #5:

score: 0
Skipped

Dependency #3:

0%