답안 #104865

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
104865 2019-04-09T11:51:31 Z daili Job Scheduling (CEOI12_jobs) C++14
0 / 100
124 ms 8932 KB
#include <bits/stdc++.h>

using namespace std;

bool check(vector<pair<int,int>> &allJobs, int currNr, int delay, int days)
{
    vector<int> used(days+1);
    for (int i = 0; i < allJobs.size(); i++)
    {
        int currentDay = allJobs[i].first;
        while(used[currentDay] >= currNr)
        {
            currentDay++;
        }
        if (currentDay > allJobs[i].first + delay)
        {
            return false;
        }
        used[currentDay]++;
    }
    return true;
}

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

    int n, d, m;
    cin >> n >> d >> m;

    vector<pair<int,int>> allJobs;
    for (int i = 0; i < m; i++)
    {
        int x;
        cin >> x;
        allJobs.push_back({x, i+1});
    }

    int left = 0;
    int right = m;

    while(left < right)
    {
        int mid = (left + right) >> 1;

        if (check(allJobs, mid, d, n))
        {
            right = mid;
        }
        else
        {
            left = mid + 1;
        }
    }

    int mid = (left+right) >> 1;
    cout << mid << "\n";

}

Compilation message

jobs.cpp: In function 'bool check(std::vector<std::pair<int, int> >&, int, int, int)':
jobs.cpp:8:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < allJobs.size(); i++)
                     ~~^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 13 ms 1660 KB Unexpected end of file - int32 expected
2 Incorrect 15 ms 1660 KB Unexpected end of file - int32 expected
3 Incorrect 16 ms 1788 KB Unexpected end of file - int32 expected
4 Incorrect 23 ms 1788 KB Unexpected end of file - int32 expected
5 Incorrect 18 ms 1660 KB Unexpected end of file - int32 expected
6 Incorrect 18 ms 1788 KB Unexpected end of file - int32 expected
7 Incorrect 13 ms 1660 KB Unexpected end of file - int32 expected
8 Incorrect 13 ms 1660 KB Unexpected end of file - int32 expected
9 Incorrect 16 ms 1788 KB Output isn't correct
10 Incorrect 14 ms 1788 KB Output isn't correct
11 Incorrect 16 ms 1788 KB Output isn't correct
12 Incorrect 24 ms 2808 KB Output isn't correct
13 Incorrect 35 ms 4844 KB Output isn't correct
14 Incorrect 66 ms 4820 KB Output isn't correct
15 Incorrect 61 ms 4840 KB Output isn't correct
16 Incorrect 77 ms 8884 KB Output isn't correct
17 Incorrect 103 ms 8928 KB Output isn't correct
18 Incorrect 105 ms 8932 KB Output isn't correct
19 Incorrect 124 ms 8928 KB Output isn't correct
20 Incorrect 123 ms 8804 KB Output isn't correct