답안 #787368

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
787368 2023-07-19T06:16:16 Z 이동현(#10034) 함박 스테이크 (JOI20_hamburg) C++17
4 / 100
129 ms 55732 KB
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
using namespace std;

signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n, k;
    cin >> n >> k;
    vector<vector<int>> a(n, vector<int>(4));
    for(int i = 0; i < n; ++i){
        cin >> a[i][0] >> a[i][1] >> a[i][2] >> a[i][3];
    }

    auto chk = [&](vector<vector<int>> x, vector<vector<int>> pos){
        for(int i = 0; i < (int)x.size(); ++i){
            int ok = 0;
            for(auto&j:pos){
                if(j[0] >= x[i][0] && j[0] <= x[i][2] && j[1] >= x[i][1] && j[1] <= x[i][3]){
                    ok = 1;
                    break;
                }
            }
            if(!ok) return 0;
        }
        return 1;
    };

    auto solve1 = [&](vector<vector<int>> x)->vector<int>{
        int xp = 1, yp = 1;
        for(int i = 0; i < (int)x.size(); ++i){
            xp = max(xp, x[i][0]);
            yp = max(yp, x[i][1]);
        }

        if(chk(x, {{xp, yp}})){
            return {1, xp, yp};
        }
        return {0};
    };

    int xu = (int)2e9, yl = (int)2e9, yr = -1;
    for(int i = 0; i < n; ++i){
        xu = min(xu, a[i][2]);
        yl = min(yl, a[i][3]);
        yr = max(yr, a[i][1]);
    }

    auto solve2 = [&](vector<vector<int>> x, int px, int py){
        vector<vector<int>> nxt;
        for(auto&i:x){
            if(!(px >= i[0] && px <= i[2] && py >= i[1] && py <= i[3])){
                nxt.push_back(i);
            }
        }
        auto rv = solve1(nxt);
        if(rv[0] == 1){
            cout << px << ' ' << py << '\n' << rv[1] << ' ' << rv[2] << '\n';
            exit(0);
        }
    };

    solve2(a, xu, yl);
    solve2(a, xu, yr);

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 468 KB Extra information in the output file
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 588 KB Output is correct
2 Correct 2 ms 852 KB Output is correct
3 Correct 1 ms 724 KB Output is correct
4 Correct 2 ms 756 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 724 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 724 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 468 KB Extra information in the output file
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 588 KB Output is correct
2 Correct 2 ms 852 KB Output is correct
3 Correct 1 ms 724 KB Output is correct
4 Correct 2 ms 756 KB Output is correct
5 Correct 93 ms 42680 KB Output is correct
6 Correct 102 ms 40932 KB Output is correct
7 Correct 110 ms 42028 KB Output is correct
8 Correct 129 ms 55732 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 724 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 724 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -