QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#102707 | #5260. The Game | fz_zsl# | WA | 2ms | 3588kb | C++14 | 2.1kb | 2023-05-03 16:28:42 | 2023-05-03 16:28:44 |
Judging History
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,Mk[6];
vector<int>Vec[7];
bool Ka;
void Push(int& a,int b){
if(t==m-2)return ;
Now[b]=A[a];
// Vec[b].push_back(A[a]);
Mk[a]=1;
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(Mk[i])continue;
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(Mk[i])continue;
if(Now[1]<A[i]&&mi==A[i]-Now[1]){
Push(i,1);
break;
}
else if(Now[2]<A[i]&&mi==A[i]-Now[2]){
Push(i,2);
break;
}
else if(Now[3]>A[i]&&mi==Now[3]-A[i]){
Push(i,3);
break;
}
else if(Now[4]>A[i]&&mi==Now[4]-A[i]){
Push(i,4);
break;
}
}
}
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)Mk[i]=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(tmp!=4)break;
t=0;
for(int i=1;i<=m;++i)if(!Mk[i])A[++t]=A[i];
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<=m;++i)
printf("%d ",A[i]);
puts("");
for(int i=n+1;i<=98;++i)
scanf("%d",&a),printf("%d ",a);
puts("");
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 2ms
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 14 16 1 5 6 7 100 100 5 6 5 6 6 7 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
result:
wrong answer 1st lines differ - expected: '1 2 3 4 5 6 7 8 9 10 11 12 13 ...9 90 91 92 93 94 95 96 97 98 99', found: '1 2 3 4 5 6 14 16 '