답안 #1027942

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1027942 2024-07-19T11:51:41 Z vjudge1 Job Scheduling (CEOI12_jobs) C++17
0 / 100
300 ms 26836 KB
#include <bits/stdc++.h>
using namespace std;

int main()
{
    //ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n, docnenje, m;
    cin>>n>>docnenje>>m;
    pair<int, int>a[m];
    for(int i=0; i<m; i++)
    {
        cin>>a[i].first;
        a[i].second=i;
    }
    sort(a, a+m);
    int l=0, r=m-1;
    vector<vector<int>>sol(n+1);
    while(r-l>1)
    {
        vector<vector<int>>rez(n+1);
        int mid=(l+r)/2;
        int index=0;
        bool kiki1=0;
        bool found=0;
        for(int i=1; i<=n && !found; i++)
        {
            bool kiki=0;
            for(int j=0; j<mid; j++)
            {
                if(a[index].first+docnenje<i)
                {
                    kiki=1;
                    break;
                }
                if(a[index].first>i)
                    break;
                index++;
                rez[i].push_back(a[index].second);
                if(index==m)
                {
                    sol=rez;
                    found=1;
                    break;
                }
            }
            if(kiki)
            {
                kiki1=1;
                break;
            }
        }
        if(kiki1)
            l=mid;
        else
            r=mid;
    }
    cout<<r<<"\n";
    for(int i=1; i<=n; i++)
    {
        for(int j=0; j<sol[i].size(); j++)
            cout<<sol[i][j]+1<<" ";
        cout<<"\n";
    }

    return 0;
}

Compilation message

jobs.cpp: In function 'int main()':
jobs.cpp:60:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   60 |         for(int j=0; j<sol[i].size(); j++)
      |                      ~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 35 ms 3396 KB Unexpected end of file - int32 expected
2 Incorrect 26 ms 3408 KB Unexpected end of file - int32 expected
3 Incorrect 26 ms 3408 KB Unexpected end of file - int32 expected
4 Incorrect 24 ms 3400 KB Unexpected end of file - int32 expected
5 Incorrect 25 ms 3652 KB Unexpected end of file - int32 expected
6 Incorrect 25 ms 3400 KB Unexpected end of file - int32 expected
7 Incorrect 32 ms 3404 KB Unexpected end of file - int32 expected
8 Incorrect 25 ms 3404 KB Unexpected end of file - int32 expected
9 Incorrect 38 ms 7468 KB Unexpected end of file - int32 expected
10 Incorrect 62 ms 7716 KB Unexpected end of file - int32 expected
11 Incorrect 53 ms 2640 KB Unexpected end of file - int32 expected
12 Incorrect 71 ms 5312 KB Unexpected end of file - int32 expected
13 Incorrect 93 ms 8276 KB Unexpected end of file - int32 expected
14 Incorrect 153 ms 11364 KB Unexpected end of file - int32 expected
15 Incorrect 189 ms 12508 KB Unexpected end of file - int32 expected
16 Incorrect 212 ms 15360 KB Unexpected end of file - int32 expected
17 Incorrect 257 ms 19812 KB Unexpected end of file - int32 expected
18 Incorrect 261 ms 20584 KB Unexpected end of file - int32 expected
19 Incorrect 300 ms 26836 KB Unexpected end of file - int32 expected
20 Incorrect 263 ms 19816 KB Unexpected end of file - int32 expected