답안 #771275

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
771275 2023-07-02T18:59:48 Z MilosMilutinovic 함박 스테이크 (JOI20_hamburg) C++14
2 / 100
258 ms 20732 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<array<int, 3>> ev;
    for (int i = 1; i <= n; i++) {
        ev.push_back({a[i], 0, i});
        ev.push_back({b[i], 1, i});
    }
    sort(ev.begin(), ev.end());
    set<int> st;
    int bal = 0;
    vector<int> res;
    for (auto& p : ev) {
        if (p[1] == 0) {
            bal += 1;
            st.insert(p[2]);
        } else {
            bal -= 1;
            if (st.find(p[2]) != st.end()) {
                res.push_back(p[0]);
                st.clear();
            }
        }
    }
    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:30:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   30 |     scanf("%d%d", &n, &k);
      |     ~~~~~^~~~~~~~~~~~~~~~
hamburg.cpp:32:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   32 |         scanf("%d%d%d%d", &l[i], &d[i], &r[i], &u[i]);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 468 KB Output is correct
2 Correct 2 ms 460 KB Output is correct
3 Correct 2 ms 464 KB Output is correct
4 Correct 2 ms 464 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 468 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 468 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 468 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 468 KB Output is correct
2 Correct 2 ms 460 KB Output is correct
3 Correct 2 ms 464 KB Output is correct
4 Correct 2 ms 464 KB Output is correct
5 Correct 256 ms 20712 KB Output is correct
6 Correct 258 ms 20732 KB Output is correct
7 Correct 255 ms 17644 KB Output is correct
8 Correct 252 ms 20700 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 468 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 468 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 468 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -