QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#545349#403. Memory2kkkgjyismine4100 ✓0ms3888kbC++201.2kb2024-09-03 10:26:322024-09-03 10:26:33

Judging History

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

  • [2024-09-03 10:26:33]
  • 评测
  • 测评结果:100
  • 用时:0ms
  • 内存:3888kb
  • [2024-09-03 10:26:32]
  • 提交

answer

#include "Memory2_lib.h"
#include<bits/stdc++.h>
using namespace std;
vector<int>vec[105];
int vis[105],ret[105];
bool chk(int n){
	int ct=0;
	for(int i=0;i<n*2;++i)ct+=(!vis[i]);
	return (ct<=2);
}
int Ct[105],Val[105];
void Solve(int Type,int n){
	for(int i=0;i<n;++i)vec[i].clear(),Ct[i]=0;
	for(int i=0;i<(n<<1);++i)vis[i]=0;
	while(1){
		int id=-1,f=1,ed=-1;
		for(int i=0;i<(n<<1);++i)if(!vis[i]){id=i;break;}
		for(int i=id+1;i<(n<<1);++i){
			if(vis[i])continue;
			int x=Flip(id,i);++Ct[x];Val[i]=x;
			if(Ct[x]>2){ret[id]=x,ed=i;vis[id]=1,f=0;break;}
		}
		if(f){
			for(int i=0;i<n;++i)Ct[i]=0;
			for(int i=id+1;i<(n<<1);++i)ret[i]=Val[i];
			for(int i=0;i<(n<<1);++i)if(i!=id)++Ct[ret[i]];
			int x=-1,y=-1;
			for(int i=0;i<n;++i){
				if(Ct[i]>2)x=i;
				if(!Ct[i])y=i;
			}
			if(x!=-1){
				ret[id]=x;
				for(int i=id+1;i<(n<<1);++i)if(!vis[i]&&ret[i]==x)ret[i]=y;
			}else for(int i=0;i<n;++i)if(Ct[i]<2)ret[id]=i;
			for(int i=0;i<(n<<1);++i)vec[ret[i]].push_back(i);
			for(int i=0;i<n;++i)Answer(vec[i][0],vec[i][1],i);
			return;
		}
		for(int i=id+1;i<=ed;++i)if(Ct[Val[i]]<=2)vis[i]=1,ret[i]=Val[i];
		for(int i=0;i<n;++i)Ct[i]=0;
	}
	return;
}

Details

Subtask #1:

score: 10
Accepted

Test #1:

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

Test #2:

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

Test #3:

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

Test #4:

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

Test #5:

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

Test #6:

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

Test #7:

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

Test #8:

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

Subtask #2:

score: 50
Accepted

Test #9:

score: 50
Accepted
time: 0ms
memory: 3820kb

Test #10:

score: 50
Accepted
time: 0ms
memory: 3844kb

Test #11:

score: 50
Accepted
time: 0ms
memory: 3832kb

Test #12:

score: 50
Accepted
time: 0ms
memory: 3884kb

Test #13:

score: 50
Accepted
time: 0ms
memory: 3848kb

Test #14:

score: 50
Accepted
time: 0ms
memory: 3764kb

Test #15:

score: 50
Accepted
time: 0ms
memory: 3852kb

Test #16:

score: 50
Accepted
time: 0ms
memory: 3852kb

Test #17:

score: 50
Accepted
time: 0ms
memory: 3828kb

Test #18:

score: 50
Accepted
time: 0ms
memory: 3848kb

Subtask #3:

score: 40
Accepted

Test #19:

score: 40
Accepted
time: 0ms
memory: 3852kb

Test #20:

score: 40
Accepted
time: 0ms
memory: 3856kb

Test #21:

score: 40
Accepted
time: 0ms
memory: 3848kb

Test #22:

score: 40
Accepted
time: 0ms
memory: 3828kb

Test #23:

score: 40
Accepted
time: 0ms
memory: 3788kb

Test #24:

score: 40
Accepted
time: 0ms
memory: 3828kb

Test #25:

score: 40
Accepted
time: 0ms
memory: 3852kb

Test #26:

score: 40
Accepted
time: 0ms
memory: 3832kb

Test #27:

score: 40
Accepted
time: 0ms
memory: 3832kb

Test #28:

score: 40
Accepted
time: 0ms
memory: 3852kb

Extra Test:

score: 0
Extra Test Passed