Submission #771269

# Submission time Handle Problem Language Result Execution time Memory
771269 2023-07-02T18:56:00 Z MilosMilutinovic Hamburg Steak (JOI20_hamburg) C++14
0 / 100
2 ms 468 KB
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int n, k, l[N], d[N], r[N], u[N];
vector<int> sweep_line(int* a, int* b) {
    vector<pair<int, int>> ev;
    for (int i = 1; i <= n; i++) {
        ev.emplace_back(a[i], 0);
        ev.emplace_back(b[i], 1);
    }
    sort(ev.begin(), ev.end());
    int bal = 0;
    vector<int> res;
    for (auto& p : ev) {
        if (p.second == 0) {
            bal += 1;
        } else {
            bal -= 1;
            if (bal == 0) {
                res.push_back(p.first);
            }
        }
    }
    return res;
}
int main() {
    scanf("%d%d", &n, &k);
    for (int i = 1; i <= n; i++) {
        scanf("%d%d%d%d", &l[i], &d[i], &r[i], &u[i]);
    }
    vector<int> xs = sweep_line(l, r);
    vector<int> ys = sweep_line(d, u);
    printf("%d %d\n", xs[0], ys[0]);
}

Compilation message

hamburg.cpp: In function 'int main()':
hamburg.cpp:27:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   27 |     scanf("%d%d", &n, &k);
      |     ~~~~~^~~~~~~~~~~~~~~~
hamburg.cpp:29:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   29 |         scanf("%d%d%d%d", &l[i], &d[i], &r[i], &u[i]);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 468 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 452 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 416 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 468 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 468 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 452 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 416 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 468 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -