QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#469052#5033. Y 君的序列Kevin53070 0ms3968kbC++231.0kb2024-07-09 11:55:542024-07-09 11:55:54

Judging History

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

  • [2024-07-09 11:55:54]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:3968kb
  • [2024-07-09 11:55:54]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#include"seq.h"
void SEQ(int n,int m)
{
	vector<int> b(n+1),a(n+1);
	for(int i=1;i<=n;i++)
	{
		a[i]=i;
		b[i]=Get(i);
	}
	answer(1);
	auto myadd=[&](int x,int y)
	{
		assert(x!=y);
		assert(a[x]%2==0);
		add(x,y);
		a[y]+=a[x]/2;
		a[x]/=2;
	};
	for(int i=n;i>=3;i--)
	{
		int pa,pb;
		for(int j=1;j<=n;j++)
		{
			if(a[j]==i) pa=j;
			if(b[j]==i) pb=j;
		}
		if(pa==pb) continue;
		int p1;
		for(int j=1;j<=n;j++)
			if(a[j]==1)
				p1=j;
		if(a[pb]==2)
			myadd(pb,p1);
		else
		{
			int pd;
			for(int j=1;j<=n;j++)
				if(a[j]==a[pb]-1)
					pd=j;
			while(a[pb]!=1)
				if(a[pb]%2)
					myadd(pd,pb);
				else
					myadd(pb,pd);
			myadd(pd,p1);
		}
		int pc;
		for(int j=1;j<=n;j++)
			if(a[j]==i-1)
				pc=j;
		while(a[pa]!=1)
			if(a[pa]%2)
				myadd(pc,pa);
			else
				myadd(pa,pc);
		myadd(pc,pb);
	}
	int p1,p2;
	for(int i=1;i<=n;i++)
		if(a[i]==1)
			p1=i;
		else if(a[i]==2)
			p2=i;
	if(a[p1]!=b[p1])
		myadd(p2,p1);
	return ;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 17
Accepted
time: 0ms
memory: 3676kb

input:

1 10000000
1

output:

Correct Answer :) Congrats!

result:

ok 4 tokens

Test #2:

score: 0
Accepted
time: 0ms
memory: 3940kb

input:

8 10000000
7 6 5 2 8 1 4 3

output:

Correct Answer :) Congrats!

result:

ok 4 tokens

Test #3:

score: -17
Wrong Answer
time: 0ms
memory: 3968kb

input:

9 10000000
9 8 3 1 7 5 4 2 6

output:

Invalid operation

result:

wrong answer 1st words differ - expected: 'Correct', found: 'Invalid'

Subtask #2:

score: 0
Wrong Answer

Test #21:

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

input:

121 1500000
121 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...

output:

Invalid operation

result:

wrong answer 1st words differ - expected: 'Correct', found: 'Invalid'

Subtask #3:

score: 0
Skipped

Dependency #2:

0%

Subtask #4:

score: 0
Skipped

Dependency #3:

0%

Subtask #5:

score: 0
Skipped

Dependency #4:

0%

Subtask #6:

score: 0
Skipped

Dependency #5:

0%