QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#818793 | #9884. Grid Construction | YMH_fourteen# | WA | 1ms | 4600kb | C++14 | 1.2kb | 2024-12-18 08:56:09 | 2024-12-18 08:56:10 |
Judging History
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
char a[1005][1005];
void f(int x,int n)
{
int l=x-n/2,r=x+n/2;
for(int i=l;i<r;i++)a[l][i]='<',a[i][r]='^';
for(int i=l+1;i<=r;i++)a[i][l]='v',a[r][i]='>';
if(n==3)return;
for(int i=l+2;i<r;i+=2)a[l+1][i]='v',a[r-1][i]='^',a[i][l+1]='>',a[i][r-1]='<';
if(n==5)return;
for(int i=l+3;i<r-1;i+=2)a[l+2][i]='^',a[r-2][i]='v',a[i][l+2]='<',a[i][r-2]='>';
f(x,n-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!=m||n%6!=3&&n%6!=5)return puts("No"),0;
memset(a,'.',sizeof(a));
for(int i=0;i<n;i++)a[i][n]=0;
f(n/2,n);
puts("Yes");
for(int i=0;i<n;i++)puts(a[i]);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 4600kb
input:
3 3
output:
Yes <<^ v.^ v>>
result:
ok Correct
Test #2:
score: 0
Accepted
time: 0ms
memory: 3672kb
input:
4 4
output:
No
result:
ok Correct : No
Test #3:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
4 5
output:
No
result:
ok Correct : No
Test #4:
score: -100
Wrong Answer
time: 0ms
memory: 3624kb
input:
11 17
output:
No
result:
wrong answer Incorrect