QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#102669#5260. The Gamefz_zsl#WA 1ms3596kbC++141.8kb2023-05-03 15:43:522023-05-03 15:43:56

Judging History

This is the latest submission verdict.

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-03 15:43:56]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 3596kb
  • [2023-05-03 15:43:52]
  • Submitted

answer

#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define ll long long
#define N 1000006
#define M 20000007
#define rep(i, j, k) for(int i = j; i <= k; ++ i)
#define per(i, j, k) for(int i = j; i >= k; -- i)
void cmin(int& a,int b){
	a>b&&(a=b);
}
bool Bar; 
int n,m,t,A[10],Now[9],a,mi,Tmp[8],tmp;
vector<int>Vec[7];
bool Ka;
void Push(int& a,int b){
	if(t==m-2)return ;
	Now[b]=A[a];
	Tmp[++tmp]=b;
	Tmp[++tmp]=A[a];
	for(int i=a;i<t;++i)A[i]=A[i+1];
	--t,--a;
}
void DO(){
	mi=1e9;
	for(int i=1;i<=t;++i){
		if(Now[1]<A[i])cmin(mi,A[i]-Now[1]);
		if(Now[2]<A[i])cmin(mi,A[i]-Now[2]);
		if(Now[3]>A[i])cmin(mi,Now[3]-A[i]);
		if(Now[4]>A[i])cmin(mi,Now[4]-A[i]);
	}
	for(int i=1;i<=t;++i){
		if(Now[1]<A[i]&&mi==A[i]-Now[1])Push(i,1);
		else if(Now[2]<A[i]&&mi==A[i]-Now[2])Push(i,2);
		else if(Now[3]>A[i]&&mi==Now[3]-A[i])Push(i,3);
		else if(Now[4]>A[i]&&mi==Now[4]-A[i])Push(i,4);
	}
}
int main(){
//	freopen("B.in","r",stdin);
//	freopen("B.out","w",stdout);
	for(int i=1;i<=8;++i)scanf("%d",&A[i]);
	Now[1]=Now[2]=1,Now[3]=Now[4]=100;
	Vec[1].push_back(1);
	Vec[2].push_back(1);
	Vec[3].push_back(100);
	Vec[4].push_back(100);
	n=8,m=8;
	for(int Case=1;Case<=49;++Case){
		t=m,tmp=0;
		for(int i=1;i<=t;++i){
			if(Now[1]==A[i]+10)Push(i,1);
			else if(Now[2]==A[i]+10)Push(i,2);
			else if(Now[3]==A[i]-10)Push(i,3);
			else if(Now[4]==A[i]-10)Push(i,4);
		}
		DO();
		DO();
		if(t!=m-2)break;
		Vec[Tmp[1]].push_back(Tmp[2]);
		Vec[Tmp[3]].push_back(Tmp[4]);
		if(n!=98){
			n+=2;
			scanf("%d %d",&A[7],&A[8]);
		}else m-=2;
	}
	for(int i=1;i<=4;++i){
		for(int j:Vec[i])printf("%d ",j);
		puts("");
	}
	for(int i=1;i<=t;++i)
		printf("%d%c",A[i]," \n"[i==t]);
	for(int i=n+1;i<=98;++i)
		scanf("%d",&a),printf("%d%c",a," \n"[i==98]);
	
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3588kb

input:

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

output:

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 
1 
100 
100 

result:

ok 5 lines

Test #2:

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

input:

99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2

output:

1 2 
1 
100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 
100 

result:

ok 5 lines

Test #3:

score: -100
Wrong Answer
time: 1ms
memory: 3596kb

input:

87 31 58 56 82 93 9 68 65 41 26 64 3 11 5 84 24 46 16 30 14 85 52 12 91 75 96 17 47 37 76 69 78 49 25 28 48 81 95 63 34 43 27 74 80 62 53 83 40 71 72 35 23 21 51 66 55 61 67 32 38 29 60 39 4 18 20 77 7 94 59 42 79 10 92 97 57 2 86 33 89 90 88 19 22 99 45 44 73 70 50 6 15 98 54 13 36 8

output:

1 9 11 16 24 14 17 28 34 62 71 74 80 81 83 95 96 97 
1 3 5 12 27 29 32 39 55 60 61 66 67 72 77 79 92 94 
100 93 87 82 68 65 64 58 56 46 41 37 31 30 26 25 35 23 21 18 4 2 
100 91 85 84 78 76 75 69 63 52 49 48 47 43 53 51 40 38 33 20 10 7 
59 42 57 86 89 90 88 19
22 99 45 44 73 70 50 6 15 98 54 13 36 8

result:

wrong answer 1st lines differ - expected: '1 9 11 16 24 14 17 26 28 30 31...4 78 80 81 71 72 83 95 96 97 99', found: '1 9 11 16 24 14 17 28 34 62 71 74 80 81 83 95 96 97 '