202009-2 第一次自己满分的第二题!

#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
const int N = 1e4;
int n, k, t, xl, yd, xr, yu;

struct Node {
    int a, b;
} node[N];
vector<Node> constant_node;
int cres;

int main() {
    cin >> n >> k >> t >> xl >> yd >> xr >> yu;
    int temp, jingguo = 0, douliu = 0;
    for (int i = 1; i <= n; i++) {
        temp = 0;
        cres = 0;
        int size = 0;
        for (int i = 1; i <= t; i ++) {
            cin >> node[i].a >> node[i].b;
            if (node[i].a >= xl && node[i].a <= xr && node[i].b >= yd && node[i].b <= yu) {
                temp++;
                constant_node.push_back(node[i]);
            } else {
                size = constant_node.size();
                cres = max(size, cres);
                constant_node.clear();
                continue;
            }
            size = constant_node.size();
            cres = max(size, cres);

        }
        constant_node.clear();

        if (cres >= k) {
            douliu++;
        }
        if (temp) {
            jingguo++;
        }
    }
    cout << jingguo << endl << douliu << endl;


}
···
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容