大佬们看一下,为啥我的代码只得了80分,一个样例RE了
查看原帖
大佬们看一下,为啥我的代码只得了80分,一个样例RE了
921616
mammal7楼主2024/5/30 23:42
#include <bits/stdc++.h>
using namespace std;
const int N = 110;
bool a[N][N];
int n , m , k;
int x , y;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> m >> k;
    for(int i = 1 ; i <= n ; i ++ )
        for(int j = 1 ; j <= n ; j ++ )
            a[i][j] = false; 
    while(m -- )
    {        
        cin >> x >> y;
        for(int i = -2 ; i <= 2 ; i ++ )
        {
            a[x - i][y] = true;
            a[x][y - i] = true;
            a[x - 1][y + 1] = a[x - 1][y - 1] = a[x + 1][y + 1] = a[x + 1][y - 1] = true;
        }
    }

    while(k -- )
    {
        cin >> x >> y;
        for(int i = -2 ; i <= 2 ; i ++ )
            for(int j = -2 ; j <= 2 ; j ++ )
                a[x - i][y - j] = true;
    }
    int cnt = 0;
    for(int i = 1 ; i <= n ; i ++ )
        for(int j = 1 ; j <= n ; j ++ )
            if(!a[i][j])
                cnt ++;
    cout << cnt << endl;
    return 0;
}
2024/5/30 23:42
加载中...