QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#818883#9884. Grid ConstructionYMH_fourteen#WA 1ms4584kbC++142.0kb2024-12-18 10:32:532024-12-18 10:32:57

Judging History

This is the latest submission verdict.

  • [2024-12-18 10:32:57]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 4584kb
  • [2024-12-18 10:32:53]
  • Submitted

answer

// Author: YE Minghan
#include<bits/stdc++.h>
using namespace std;
#ifdef DEBUG
#include "templates/debug.h"
#define __int128 ll
#else
#define dbg(...) (void)0
#define msg(...) (void)0
#endif
#define ll long long
#define endl '\n'
#define PB emplace_back
#define PPB pop_back
#define MP make_pair
#define ALL(Name) Name.begin(),Name.end()
#define PII pair<int,int>
#define VI vector<int>
#define GI greater<int>
#define fi first
#define se second

const char s9[5][7]=
{
	"<v>.^.",
	".v.^>>",
	">.<^.v",
	".^.<<v",
	"<^>.v."
};
char a[1005][1005];
void f(int x,int y,int n,int m)
{
	int lx=x-n/2,rx=x+n/2,ly=y-m/2,ry=y+m/2;
	for(int i=ly;i<ry;i++)a[lx][i]='<',a[rx][i+1]='>';
	for(int i=lx;i<rx;i++)a[i+1][ly]='v',a[i][ry]='^';
	if(n==3)return;
	for(int i=ly+2;i<ry;i+=2)a[lx+1][i]='v',a[rx-1][i]='^';
	for(int i=lx+2;i<rx;i+=2)a[i][ly+1]='>',a[i][ry-1]='<';
	if(n==5)return;
	if(n==9&&m>9)
	{
		a[x][ly+2]=a[x][ly+3]='>';
		a[x][ry-2]=a[x][ry-3]='<';
		a[x-1][ly+2]=a[x-1][ry-2]='^';
		a[x+1][ly+2]=a[x+1][ry-2]='v';
		for(int cy=ly+3;cy<=ry-3;cy++)
			for(int cx=x-2;cx<=x+2;cx++)
				a[cx][cy]=s9[cx-x+2][(cy-ly-3)%6];
		return;
	}
	for(int i=ly+3;i<ry-1;i+=2)a[lx+2][i]='^',a[rx-2][i]='v';
	for(int i=lx+3;i<rx-2;i+=2)a[i][ly+2]='<',a[i][ry-2]='>';
	f(x,y,n-6,m-6);
}

int main()
{
	ios::sync_with_stdio(false),cin.tie(nullptr);
//	int _;cin>>_;while(_--)

	int n,m;
	cin>>n>>m;
	if(n==2&&m==2)return puts("Yes\n<^\nv>"),0;
	if(n%6!=m%6||n%6!=3&&n%6!=5)return puts("No"),0;
	memset(a,'.',sizeof(a));
	bool SWP=0;
	if(n>m)swap(n,m),SWP=1;
	f(n/2,m/2,n,m);
	puts("Yes");
	if(SWP)
	{
		for(int i=0;i<n;i++)
			for(int j=0;j<m;j++)
				if(a[i][j]=='<')a[i][j]='^';
				else if(a[i][j]=='^')a[i][j]='<';
				else if(a[i][j]=='>')a[i][j]='v';
				else if(a[i][j]=='v')a[i][j]='>';
		for(int i=0;i<m;i++)
			for(int j=i+1;j<m;j++)
				swap(a[i][j],a[j][i]);
		swap(n,m);
	}
	for(int i=0;i<n;i++)a[i][m]=0,puts(a[i]);

	return 0;
}

詳細信息

Test #1:

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

input:

3 3

output:

Yes
<<^
v.^
v>>

result:

ok Correct

Test #2:

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

input:

4 4

output:

No

result:

ok Correct : No

Test #3:

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

input:

4 5

output:

No

result:

ok Correct : No

Test #4:

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

input:

11 17

output:

Yes
<<<<<<<<<<<<<<<<^
v.v.v.v.v.v.v.v.^
v>.^.^.^.^.^.^.<^
v.<<<<<<<<<<<^>.^
v>.v.v.v.v.v.^.<^
v.<v>.......<^>.^
v>.v.^.^.^.^.^.<^
v.<v>>>>>>>>>>>.^
v>.v.v.v.v.v.v.<^
v.^.^.^.^.^.^.^.^
v>>>>>>>>>>>>>>>>

result:

wrong answer Not enough segments