답안 #1000053

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1000053 2024-06-16T14:16:53 Z Unforgettablepl 함박 스테이크 (JOI20_hamburg) C++17
4 / 100
57 ms 14420 KB
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
 
void strat1(int n){
    pair<int,int> curr_x = {1,1e9};
    pair<int,int> curr_y = {1,1e9};
    auto combine = [&](pair<int,int> a,pair<int,int> b){
        return make_pair(max(a.first,b.first),min(a.second,b.second));
    };
    for(int i=1;i<=n;i++){
        pair<int,int> x,y;
        cin >> x.first >> y.first >> x.second >> y.second;
        curr_x = combine(curr_x,x);
        curr_y = combine(curr_y,y);
    }
    cout << curr_x.first << ' ' << curr_y.first << '\n';
}
 
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n,k;
    cin >> n >> k;
    if(k==1)strat1(n);
    assert(k==2);
    int minR = 1e9,minU = 1e9,maxL = 1,maxD = 1;
    vector<pair<pair<int,int>,pair<int,int>>> rect(n);
    for(auto&[a,b]:rect){
        cin >> a.first >> b.first >> a.second >> b.second;
        maxL = max(maxL,a.first);
        minR = min(minR,a.second);
        minU = min(minU,b.second);
        maxD = max(maxD,b.first);
    }
    int satisa = 0,satisb = 0;
    auto intersect = [&](pair<int,int> point,pair<pair<int,int>,pair<int,int>> rec){
        return rec.first.first <= point.first and point.first <=rec.first.second and rec.second.first <= point.second and point.second <= rec.second.second;
    };
    for(auto&i:rect){
        if(intersect({minR,minU},i) or intersect({maxL,maxD},i))satisa++;
        if(intersect({minR,maxD},i) or intersect({maxL,minU},i))satisb++;
    }
    if(satisa==n)cout<<minR<<' '<<minU<<'\n'<<maxL<<' '<<maxD<<'\n';
    else cout<<minR<<' '<<maxD<<'\n'<<maxL<<' '<<minU<<'\n';
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 604 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 604 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 600 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 600 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 604 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 604 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 53 ms 14420 KB Output is correct
6 Correct 55 ms 14416 KB Output is correct
7 Correct 54 ms 14260 KB Output is correct
8 Correct 57 ms 14388 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 600 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 600 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -