QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#150486#4923. 整数zhouhuanyi0 8ms3836kbC++141.1kb2023-08-25 17:53:242023-08-25 17:53:25

Judging History

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

  • [2023-08-25 17:53:25]
  • 评测
  • 测评结果:0
  • 用时:8ms
  • 内存:3836kb
  • [2023-08-25 17:53:24]
  • 提交

answer

#include"integer.h"
#include<iostream>
#include<cstdio>
#include<vector>
#include<cstdlib>
#include<random>
#include<algorithm>
#define N 5000
using namespace std;
mt19937 RAND(random_device{}());
int delta[N+1],p[N+1],p2[N+1],length,length2,res,cnt;
bool used[N+1];
bool cmp(int x,int y)
{
	return delta[x]<delta[y];
}
vector<int>findPermutation(int n)
{
	vector<int>v(n);
	int dres,ps;
	for (int i=1;i<=n;++i) p[i]=i-1;
	shuffle(p+1,p+n+1,RAND);
	for (int i=1;i<=n;++i) res=operate(i-1);
	length=n;
	while (1)
	{
		sort(p+1,p+length+1,cmp),ps=n,length2=0;
		for (int i=0;i<n;++i) used[i]=0;
		for (int i=1;i<=length;++i)
		{
			delta[p[i]]+=i,dres=res,used[p[i]]=1;
			if (i==1) dres+=(__builtin_popcount(cnt+1)-__builtin_popcount(cnt)-1);
			res=operate(p[i]);
			if (res<=dres) v[p[i]]=ps-(dres-res+1),ps=v[p[i]];
			else p2[++length2]=p[i];
		}
		if (!length2) break;
		for (int i=0;i<n;++i)
			if ((!used[i]||i==ps)&&v[i]>=ps)
				res=operate(i);
		length=length2,cnt++;
		for (int i=1;i<=length;++i) p[i]=p2[i];
	}
	return v;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

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

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

input:

3
0 2 1

output:

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

result:

ok Passed using 8 operation(s): scoring 1.000

Test #3:

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

input:

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

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

input:

10
0 2 8 9 1 5 6 3 4 7

output:

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

result:

ok Passed using 30 operation(s): scoring 1.000

Test #5:

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

input:

10
1 8 3 2 6 0 7 9 5 4

output:

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

result:

ok Passed using 48 operation(s): scoring 1.000

Test #6:

score: 0
Wrong Answer
time: 1ms
memory: 3656kb

input:

10
9 7 0 8 3 5 2 6 1 4

output:

68F82AC1898AF4BFACDCBB49543233A61773093A
WA
Incorrect answer: p_1 is expected to be 7 but found 9

result:

wrong answer Incorrect answer: p_1 is expected to be 7 but found 9

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Skipped

Dependency #2:

0%

Subtask #4:

score: 0
Wrong Answer

Test #84:

score: 0
Wrong Answer
time: 8ms
memory: 3836kb

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
WA
Incorrect answer: p_2 is expected to be 1149 but found 2649

result:

wrong answer Incorrect answer: p_2 is expected to be 1149 but found 2649

Subtask #5:

score: 0
Skipped

Dependency #3:

0%