답안 #1027035

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1027035 2024-07-18T19:05:07 Z kkkkkkkk Job Scheduling (CEOI12_jobs) C++14
0 / 100
162 ms 19752 KB
#include <bits/stdc++.h>

using namespace std;

int n, d, m;
vector<pair<int,int> > v;
vector<vector<int> > rez;

bool ok(int masini) {
    int den=1;
    vector<vector<int> > raspored(n+1);
    for (int i=0;i<m;i+=masini) {
        for (int j=i;j<i+masini;j++) {
            while (v[j].first>den)
                den++;
            if (v[j].first+d<den)
                return false;
            raspored[den].push_back(v[j].second);
        }
        den++;
    }
    rez.clear();
    rez=raspored;
    return true;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> d >> m;
    v.resize(m);
    for (int i=0;i<m;i++) {
        cin >> v[i].first;
        v[i].second=i+1;
    }
    sort(v.begin(), v.end());
    int l=0, r=m;
    while (l+1<r) {
        int mid=(l+r)/2;
        if (ok(mid)) r=mid;
        else l=mid;
    }
    cout << r << '\n';
    /*for (int i=1;i<rez.size();i++) {
        for (auto x:rez[i])
            cout << x << " ";
        cout << "0" << '\n';
    }*/

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 18 ms 2756 KB Unexpected end of file - int32 expected
2 Incorrect 15 ms 2760 KB Unexpected end of file - int32 expected
3 Incorrect 14 ms 2760 KB Unexpected end of file - int32 expected
4 Incorrect 20 ms 2760 KB Unexpected end of file - int32 expected
5 Incorrect 15 ms 2756 KB Unexpected end of file - int32 expected
6 Incorrect 15 ms 2768 KB Unexpected end of file - int32 expected
7 Incorrect 14 ms 2760 KB Unexpected end of file - int32 expected
8 Incorrect 14 ms 2756 KB Unexpected end of file - int32 expected
9 Incorrect 21 ms 6964 KB Output isn't correct
10 Incorrect 22 ms 6852 KB Output isn't correct
11 Incorrect 19 ms 2140 KB Output isn't correct
12 Incorrect 35 ms 3672 KB Output isn't correct
13 Incorrect 54 ms 5884 KB Output isn't correct
14 Incorrect 102 ms 8040 KB Output isn't correct
15 Incorrect 88 ms 8988 KB Output isn't correct
16 Incorrect 146 ms 11368 KB Output isn't correct
17 Incorrect 156 ms 13668 KB Output isn't correct
18 Incorrect 142 ms 14932 KB Output isn't correct
19 Incorrect 159 ms 19752 KB Output isn't correct
20 Incorrect 162 ms 13668 KB Output isn't correct