QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#813522#9884. Grid Constructionucup-team1004#WA 1ms4020kbC++202.1kb2024-12-14 09:53:512024-12-14 09:53:51

Judging History

This is the latest submission verdict.

  • [2024-12-14 09:53:51]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 4020kb
  • [2024-12-14 09:53:51]
  • Submitted

answer

#include<bits/stdc++.h>
#define Gc() getchar()
#define Me(x,y) memset(x,y,sizeof(x))
#define Mc(x,y) memcpy(x,y,sizeof(x))
#define d(x,y) ((m)*(x-1)+(y))
#define R(n) (rnd()%(n)+1)
#define Pc(x) putchar(x)
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
#define eb emplace_back
#define all(x) x.begin(),x.end()
using namespace std;using ll=long long;using db=double;using lb=long db;using ui=unsigned;using ull=unsigned long long;using pii=pair<int,int>;
const int N=1e3+5,M=N*4+5,K=1000+5,mod=998244353,Mod=mod-1;const db eps=1e-9;const int INF=1e9+7;mt19937 rnd(28382);
#define Tp template<typename T>
#define Ts template<typename T,typename... Ar>
namespace Debug{
	Tp void _debug(char* f,T t){cerr<<f<<'='<<t<<endl;}
	Ts void _debug(char* f,T x,Ar... y){while(*f!=',') cerr<<*f++;cerr<<'='<<x<<",";_debug(f+1,y...);}
	#ifdef LOCAL
	#define gdb(...) _debug((char*)#__VA_ARGS__,__VA_ARGS__)
	#else 
	#define gdb(...) void()
	#endif
}using namespace Debug;
int n,m;
char ans[N][N];
void construct(int n,int sx,int sy){
	for(int i=1;i<n;i++){
		ans[sx][sy+i-1]='<';
		ans[sx+n-1][sy+i]='>';
		ans[sx+i][sy]='v';
		ans[sx+i-1][sy+n-1]='^';
	}
	if(n<=3){
		if(n==3) ans[sx+1][sy+1]='.';
		return;
	}
	for(int i=3;i<n;i+=2){
		ans[sx+1][sy+i-1]='v';
		ans[sx+n-1-1][sy+i-1]='^';
		ans[sx+i-1][sy+1]='>';
		ans[sx+i-1][sy+n-2]='<';
	} 
	for(int i=4;i<n-2;i+=2){
		ans[sx+2][sy+i-1]='^';
		ans[sx+n-3][sy+i-1]='v';
		ans[sx+i-1][sy+2]='<';
		ans[sx+i-1][sy+n-3]='>';
	}
	construct(n-6,sx+3,sy+3);
	
}
void Solve(){
	for(int x:{0,1,2}) for(int y:{0,1,2}) if((x*(y+1)+y*(x+1))%3==0) gdb(x,y);
	scanf("%d%d",&n,&m);
	if(n^m){
		puts("No");
		return;
	}
	if(n%3==1){
		puts("No");
		return;
	}
	if(n%3==0&&n%2==0){
		puts("No");
		return;
	}
	if(n%3==2&&n%2==0&&n>2){
		puts("No");
		return;
	}
	puts("Yes");
	for(int i=1;i<=n;i++) for(int j=1;j<=n;j++) ans[i][j]='.';
	construct(n,1,1);
	for(int i=1;i<=n;i++) printf("%s\n",ans[i]+1);
}
int main(){
	int t=1;
	// scanf("%d",&t);
	while(t--) Solve();
	cerr<<clock()*1.0/CLOCKS_PER_SEC<<'\n';
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3 3

output:

Yes
<<^
v.^
v>>

result:

ok Correct

Test #2:

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

input:

4 4

output:

No

result:

ok Correct : No

Test #3:

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

input:

4 5

output:

No

result:

ok Correct : No

Test #4:

score: -100
Wrong Answer
time: 0ms
memory: 3976kb

input:

11 17

output:

No

result:

wrong answer Incorrect