QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#672711#9439. Aim HighzhouhuanyiAC ✓0ms3716kbC++141.3kb2024-10-24 18:22:332024-10-24 18:22:33

Judging History

This is the latest submission verdict.

  • [2024-10-24 18:22:33]
  • Judged
  • Verdict: AC
  • Time: 0ms
  • Memory: 3716kb
  • [2024-10-24 18:22:33]
  • Submitted

answer

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<random>
#define N 200
using namespace std;
mt19937 RAND(random_device{}());
int read()
{
	char c=0;
	int sum=0;
	while (c<'0'||c>'9') c=getchar();
	while ('0'<=c&&c<='9') sum=sum*10+c-'0',c=getchar();
	return sum;
}
struct reads
{
	int x1,y1,x2,y2,x3,y3;
};
reads st[N*N+1];
int T,n,leng;
void append(int x,int y,int type)
{
	if (!type) st[++leng]=(reads){x-1,y-1,x,y-1,x,y};
	else st[++leng]=(reads){x+1,y-1,x,y-1,x,y};
	return;
}
const int delta[12][10]={{0,0,0,0,0,1,0,0,0,0},{0,0,0,0,1,1,0,0,0,0},{0,0,0,1,1,1,1,0,0,0},{0,0,1,2,1,1,2,1,0,0},{0,1,3,2,2,2,2,3,1,0},{0,2,3,2,1,1,2,3,2,0},{0,1,3,3,1,1,3,3,1,0},{0,2,2,2,2,2,2,2,2,0},{1,2,2,2,1,1,2,2,2,1},{1,2,2,1,0,0,1,2,2,1},{1,2,1,0,0,0,0,1,2,1},{1,1,0,0,0,0,0,0,1,1}};
bool used[8][10];
int main()
{
	used[0][5]=used[3][4]=used[3][5]=used[6][3]=used[6][6]=1;
	for (int i=0;i<=9;++i) used[5][i]=1;
	for (int i=0;i<=11;++i)
		for (int j=0;j<=9;++j)
			if (delta[i][j]>(i>=4))
			{
			    for (int k=1;k<=delta[i][j]-(i>=4);++k) append(j,4-i,(j>=5)^used[i][j]);
			}
	T=read();
	while (T--)
	{
		n=read();
		if (n<=4)
		{
			printf("%d\n",leng);
			for (int i=leng;i>=1;--i) printf("%d %d %d %d %d %d\n",st[i].x1,st[i].y1,st[i].x2,st[i].y2,st[i].x3,st[i].y3);
		}
		else puts("-1");
	}
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3716kb

input:

1
1

output:

59
9 -7 8 -7 8 -6
0 -7 1 -7 1 -6
9 -6 8 -6 8 -5
8 -6 7 -6 7 -5
1 -6 2 -6 2 -5
0 -6 1 -6 1 -5
9 -5 8 -5 8 -4
8 -5 7 -5 7 -4
7 -5 6 -5 6 -4
2 -5 3 -5 3 -4
1 -5 2 -5 2 -4
0 -5 1 -5 1 -4
9 -4 8 -4 8 -3
8 -4 7 -4 7 -3
7 -4 6 -4 6 -3
6 -4 5 -4 5 -3
3 -4 4 -4 4 -3
2 -4 3 -4 3 -3
1 -4 2 -4 2 -3
0 -4 1 -4 1 ...

result:

ok Output is valid. OK

Test #2:

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

input:

6
1
2
3
4
5
6

output:

59
9 -7 8 -7 8 -6
0 -7 1 -7 1 -6
9 -6 8 -6 8 -5
8 -6 7 -6 7 -5
1 -6 2 -6 2 -5
0 -6 1 -6 1 -5
9 -5 8 -5 8 -4
8 -5 7 -5 7 -4
7 -5 6 -5 6 -4
2 -5 3 -5 3 -4
1 -5 2 -5 2 -4
0 -5 1 -5 1 -4
9 -4 8 -4 8 -3
8 -4 7 -4 7 -3
7 -4 6 -4 6 -3
6 -4 5 -4 5 -3
3 -4 4 -4 4 -3
2 -4 3 -4 3 -3
1 -4 2 -4 2 -3
0 -4 1 -4 1 ...

result:

ok Output is valid. OK

Extra Test:

score: 0
Extra Test Passed