QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#106331#3553. Hamburg Steakbashkort#0 0ms0kbC++201.5kb2023-05-17 14:15:372024-05-31 13:38:37

Judging History

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

  • [2024-05-31 13:38:37]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:0kb
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-17 14:15:37]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

struct Rect {
    int x1, y1, x2, y2;

    bool in(int x, int y) {
        return x1 <= x && x <= x2 && y1 <= y && y <= y2;
    }
};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n, k;
    cin >> n >> k;

    vector<Rect> r(n);

    for (auto &[x1, y1, x2, y2] : r) {
        cin >> x1 >> y1 >> x2 >> y2;
    }

    auto dfs = [&](auto self, vector<Rect> p, int cnt) -> void {
        if (cnt == 0) {
            assert(p.empty());
            return;
        } else if (p.empty()) {
            cout << "1 1\n";
            self(self, p, cnt - 1);
        }

        vector<pair<int, int>> pts;

        for (auto [x1, y1, x2, y2] : p) {
            pts.emplace_back(x1, y1);
            pts.emplace_back(x2, y2);
            pts.emplace_back(x1, y2);
            pts.emplace_back(x2, y1);
        }

        int m = size(pts);
        vector<int> freq(m);

        for (auto &r : p) {
            for (int i = 0; i < m; ++i) {
                freq[i] += r.in(pts[i].first, pts[i].second);
            }
        }

        int i = max_element(freq.begin(), freq.end()) - freq.begin();
        cout << pts[i].first << " " << pts[i].second << '\n';
        vector<Rect> nxt;

        for (int j = 0; j < size(p); ++j) {
            if (!p[j].in(pts[i].first, pts[i].second)) {
                nxt.push_back(p[j]);
            }
        }

        self(self, nxt, cnt - 1);
    };

    dfs(dfs, r, k);

    return 0;
}

詳細信息

Subtask #1:

score: 0
Runtime Error

Test #1:

score: 0
Runtime Error

input:

1936 1
275634612 269663887 525116613 936487725
97408668 7442476 814869170 687312206
436819238 107950642 958111100 591552952
7518596 205530980 782566587 854412425
496572510 309198877 998274921 764947740
205948014 311140816 696959672 600779117
332275583 5172242 984611829 780400859
404519140 226954535 ...

output:


result:


Subtask #2:

score: 0
Runtime Error

Test #5:

score: 0
Runtime Error

input:

1928 2
257715250 61165602 852430884 888048968
291121137 322570367 570606015 908598504
418176729 319924920 611676731 632485660
33180758 215166338 468783003 795212414
441068331 188624227 750676748 613482091
344172819 322492096 940801573 568738370
246507550 338324125 785514636 678843646
100885653 12352...

output:


result:


Subtask #3:

score: 0
Runtime Error

Test #9:

score: 0
Runtime Error

input:

1980 3
580358104 434053443 986861108 684634218
125969708 5379869 593299091 644204766
366688051 54873592 662708561 602035535
211630750 166795940 981075947 676159693
524950613 414516203 951984898 573261034
10925143 210994662 543601795 609644115
82102881 63393894 401995062 922075556
245641393 276511435...

output:


result:


Subtask #4:

score: 0
Runtime Error

Test #21:

score: 0
Runtime Error

input:

1989 4
20688201 462820019 870557654 779905491
299122723 258293216 630017062 521792413
430322558 33567880 691187720 757852374
104994597 262388698 979697437 904439328
237383344 375297588 673858769 638443621
715773360 364818076 896724313 888051478
235043050 422124296 833892854 936850257
434942952 25412...

output:


result:


Subtask #5:

score: 0
Skipped

Dependency #1:

0%

Subtask #6:

score: 0
Skipped

Dependency #2:

0%

Subtask #7:

score: 0
Skipped

Dependency #3:

0%

Subtask #8:

score: 0
Skipped

Dependency #4:

0%