UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#211935#3815. 种树zhangryCompile Error//C++1.1kb2024-10-13 08:56:542024-10-13 12:51:45

answer

#include<bits/stdc++.h>
#define int long long
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define awa return 0;
using namespace std;
int n,m;
int k;
int ans;
vector<vector<int>> a;
bool check(int x,int y)
{
    if(a[x][y]==1)
    {
        return false;
    }
    if(x>0&&a[x-1][y]==1)
    {
        return false;
    }
    if(x<n-1&&a[x+1][y]==1)
    {
        return false;
    }
    if(y>0&&a[x][y-1]==1)
    {
        return false;
    }
    if(y<m-1&&a[x][y+1]==1)
    {
        return false;
    }
    return true;
}
void tree(int p,int x,int y)
{
    if(p==k)
    {
        ans++;
        return ;
    }
    for(int i=x;i<n;i++)
    {
        for(int j=(i==x?y:0);j<m;j++)
        {
            if(check(i,j))
            {
                a[i][j]=1;
                tree(p+1,i,j+1);
                a[i][j]=0;
            }
        }
    }
}
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>n>>m;
    cin>>k;
    a=vector<vector<int>>(n,vector<int>(m,0));
    tree(0,0,0);
    cout<<ans;
    awa
}
//

详细

answer.code:9:18: error: '>>' should be '> >' within a nested template argument list
 vector<vector<int>> a;\x0d
                  ^
answer.code: In function 'int main()':
answer.code:61:24: error: '>>' should be '> >' within a nested template argument list
     a=vector<vector<int>>(n,vector<int>(m,0));\x0d
                        ^