개발자 톡

연습문제 톡 [HSAT 2회 정기 코딩 인증평가 기출] 사물인식 최소 면적 산출 프로그램

사물인식 최소 면적 산출 프로그램 반례 부탁합니다.

등록일
2021-10-14 14:23:01
조회수
1036
작성자
endland


테케는 통과, 추가 문제에서 오답이 많네요. 

#include 
#include 
#include 
#include 
#include 
#include 

using namespace std;

struct points
{
    int x, y, k;
};

vector p1, p2;

int n, m, a, b, c, cnt, s, e;
int color[30];
int ans = 1000000000;

bool compx(const points &a, const points &b)
{
    if (a.x < b.x) return true;
    else if (a.x == b.x)
    {
        if (a.y < b.y) return true;
        else if (a.y == b.y)
        {
            if (a.k < b.k) return true;
        }
    }
    return false;
}

bool compy(const points &a, const points &b)
{
    if (a.y < b.y) return true;
    else if (a.y == b.y)
    {
        if (a.x < b.x) return true;
        else if (a.x == b.x)
        {
            if (a.k < b.k) return true;
        }
    }
    return false;
}

int main()
{
    cin>>n>>m;
    for (int i = 0; i>a>>b>>c;
        p1.push_back({a,b,c});

    }
    sort(p1.begin(), p1.end(), compx);
    //for(auto i:p1) cout<


#[hsat_2회_정기_코딩_인증평가_기출]_사물인식_최소_면적_산출_프로그램
#cpp

이 카테고리의 톡 더보기