QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#818203#9884. Grid Constructionucup-team4975#WA 0ms3728kbC++232.6kb2024-12-17 17:38:592024-12-17 17:39:00

Judging History

This is the latest submission verdict.

  • [2024-12-17 17:39:00]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 3728kb
  • [2024-12-17 17:38:59]
  • Submitted

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||h==0&&w==0){
            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: 3492kb

input:

3 3

output:

Yes
<<^
v.^
v>>

result:

ok Correct

Test #2:

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

input:

4 4

output:

No

result:

ok Correct : No

Test #3:

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

input:

4 5

output:

No

result:

ok Correct : No

Test #4:

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

input:

11 17

output:

No

result:

wrong answer Incorrect