QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#261013#7796. Axis-Aligned AreaGeospiza#WA 0ms3620kbC++201.7kb2023-11-22 17:22:222023-11-22 17:22:22

Judging History

你现在查看的是最新测评结果

  • [2023-11-22 17:22:22]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3620kb
  • [2023-11-22 17:22:22]
  • 提交

answer

//#pragma GCC optimize(3,"Ofast","inline")
//#pragma GCC optimize(2)
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
ll g[123][123][123];
ll f[123][123][123];
#define rep(i,a,b) for(ll i=a;i<=b;++i)
string ans;
void dfs(ll i,ll j,ll k)
{
    if(i==0)return ;
    ll kk=g[i][j][k];
    if(kk==-1)
    {
        ans+="SC";
        dfs(i-1,j+1,k+1);
    }
    else if(kk==-2)
    {
        ans+="S";
        dfs(i-1,j+1,k);
    }
    else 
    {
        dfs(kk,j,k);
        dfs(i-kk,j+kk,k+kk);
    }
}
int	main()
{
    ios::sync_with_stdio(0); cin.tie(0);
    int T=1;
    while(T--)
    {
        int n;
        cin>>n;
        vector<int>a(n),b(n);
        for(auto &x:a)cin>>x;
        for(auto &x:b)cin>>x;
        rep(i,0,n)rep(j,0,i)f[0][i][j]=1;
        rep(i,1,n)rep(j,0,n-i)rep(k,0,j)
        {
            if(a[j]==b[k]&&f[i-1][j+1][k+1]!=0)
            {
                f[i][j][k]=1;
                g[i][j][k]=-1;
            }
            else if(a[j]==b[k+i-1]&&f[i-1][j+1][k]!=0)
            {
                f[i][j][k]=1;
                g[i][j][k]=-2;
            }
             rep(p,1,i-1)
            {
                if(f[p][j][k]!=0&&f[i-p][j+p][k+p]!=0)
                {
                    f[i][j][k]=1;
                    g[i][j][k]=p;
                }
            }
        }
        if(f[n][0][0]==0)
        {
            cout<<"NO\n";
            return 0;
        }
        dfs(n,0,0);
        cout<<"YES\n";
        cout<<ans<<"\n";
    }
}
/*
6
4 2 4 3 1 3
3 4 1 2 4 3

4 2 4

10
4 3 2 2 2 1 5 4 4 1
4 2 3 1 4 5 4 1 2 2

CSCCCSCCS
q:4 2 4
*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3620kb

input:

2
2
4
7

output:

NO

result:

wrong output format Expected integer, but "NO" found