QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#817880 | #9884. Grid Construction | ucup-team4975# | WA | 0ms | 3752kb | C++23 | 2.6kb | 2024-12-17 14:15:42 | 2024-12-17 14:15:42 |
Judging History
answer
#define LOCAL
#include <bits/stdc++.h>
#define fir first
#define sec second
#define el '\n'
#ifdef LOCAL
#define FINISH cerr << "FINISH" << endl;
#else
#define FINISH ;
#endif
#ifdef LOCAL
#define debug(x) cerr << setw(4) << #x << " == " << x << endl
#else
#define debug(x)
#endif
#ifdef LOCAL
#define debugv(x) \
cerr << setw(4) << #x << ":: "; \
for (auto i : x) \
cerr << i << " "; \
cerr << endl
#else
#define debugv(x)
#endif
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
ostream& operator<<(ostream& out, PII& x)
{
out << x.fir << " " << x.sec << endl;
return out;
}
const int mod = 998244353;
const ll inf = 0x3f3f3f3f3f3f3f3f;
const int N = 200020;
void solve()
{
int H,W;
cin>>H>>W;
vector<string> ans(H,string(W,'.'));
bool flag=true;
auto dfs=[&](auto dfs,int x,int y,int h,int w)->void{
if((2*h*w+h+w)%3!=0){
flag=false;
return;
}
for(int i=0;i<w-1;i++){
ans[x][y+i]='<';
ans[x+h-1][y+w-1-i]='>';
}
for(int i=0;i<h-1;i++){
ans[x+i][y+w-1]='^';
ans[x+h-1-i][y]='v';
}
x++;y++;h-=2;w-=2;
if(h==1&&w==1){
return;
}
else if(h%2==0||w%2==0){
flag=false;
return;
}
else{
for(int i=1;i<w;i+=2){
ans[x][y+i]='v';
ans[x+h-1][y+i]='^';
}
for(int i=1;i<h;i+=2){
ans[x+i][y]='>';
ans[x+i][y+w-1]='<';
}
x++;y++;h-=2;w-=2;
if(h==1&&w==1)return;
else if(h==1||w==1){
flag=false;
return;
}
else{
for(int i=1;i<w;i+=2){
ans[x][y+i]='^';
ans[x+h-1][y+i]='V';
}
for(int i=1;i<h;i+=2){
ans[x+i][y]='<';
ans[x+i][y+w-1]='>';
}
x++;y++;h-=2;w-=2;
dfs(dfs,x,y,h,w);
}
}
};
dfs(dfs,0,0,H,W);
if(flag){
cout<<"Yes\n";
for(string str:ans)cout<<str<<"\n";
}
else{
cout<<"No\n";
}
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int T = 1;
//cin >> T;
while (T--) {
solve();
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3612kb
input:
3 3
output:
Yes <<^ v.^ v>>
result:
ok Correct
Test #2:
score: 0
Accepted
time: 0ms
memory: 3752kb
input:
4 4
output:
No
result:
ok Correct : No
Test #3:
score: 0
Accepted
time: 0ms
memory: 3720kb
input:
4 5
output:
No
result:
ok Correct : No
Test #4:
score: -100
Wrong Answer
time: 0ms
memory: 3604kb
input:
11 17
output:
No
result:
wrong answer Incorrect