30求调
查看原帖
30求调
763222
Cyx43楼主2023/7/30 11:47

代码如下:

#include <bits/stdc++.h>
using namespace std;
int n;
long long a, b, g, k;
long long x, y;
int m[10000][10000];
void cover( int ta, int tb, int tg, int tk, int num )
{
    for ( int i = ta ; i <= ta + tg ; i++ )
    {
        for ( int j = tb ; j <= tb + tk ; j++ )
        {
            m[i][j] = num;
        }
    }
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin >> n;
    for ( int i = 0 ; i < n ; i++ )
    {
        cin >> a >> b >> g >> k;
        cover( a, b, g, k, i );
    }
    cin >> x >> y;
    if ( m[x][y] == 0 )
    {
        cout << -1;
    } else {
        cout << m[x][y] + 1;
    }
    return 0;
}

(我知道内存过大,但是没思路

2023/7/30 11:47
加载中...