개발자 톡

연습문제 톡 [21년 재직자 대회 예선] 회의실 예약

회의실 예약 ㅠㅠㅠㅠㅠ

등록일
2022-10-03 22:50:55
조회수
799
작성자
bungae104

30점 밖에 못받았어요 ㅠㅠㅠㅠ

반례있을까요???


//회의실 배정
//구조체 이용해서 풀면 될 것 같다
/*
3 7
grandeur
avante
sonata
sonata 14 16
grandeur 11 12
avante 15 18
sonata 10 11
avante 9 12
grandeur 16 18
avante 12 15
출력예제1
Room avante:
Not available
-----
Room grandeur:
2 available:
09-11
12-16
-----
Room sonata:
3 available:
09-10
11-14
16-18
*/
#include 
#include 
#include 

using namespace std;

//globals
int rooms, conferences;
vector>> graph;
vector>>> total_time_line;

void Input(){
    cin>>rooms>>conferences;
    vector visited;

    for(int i=0; i<9; i++){
        visited.push_back(false);
    }

    for(int i=0; i>tmp;
        graph.push_back({tmp,visited});
    }

    for(int i=0; i>tmp>>st>>ed;
        for(int j=0; j> time_line;
        int cnt=0;
        int st;
        bool isStart=true;
        for(int j=0; j<9; j++){
            if(!graph[i].second[j] && isStart){
                cnt=0;
                st=j;
                isStart=false;
            }
            else if (graph[i].second[j] && !isStart){
                time_line.push_back({st,st+cnt});
                st=0;
                isStart=true;
            }
            else if(!graph[i].second[j] && !isStart && j==8){
                cnt++;
                time_line.push_back({st,st+cnt});
                isStart=true;
            }
            cnt++;
        }
        total_time_line.push_back({graph[i].first,time_line});
    }

}

void Output(){
    for(int i=0; i



#[21년_재직자_대회_예선]_회의실_예약
#c++

이 카테고리의 톡 더보기