답안 #1027935

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1027935 2024-07-19T11:47:16 Z vjudge1 Job Scheduling (CEOI12_jobs) C++17
0 / 100
283 ms 26920 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=n-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 14 ms 1744 KB Output isn't correct
2 Incorrect 14 ms 1832 KB Output isn't correct
3 Incorrect 14 ms 1744 KB Output isn't correct
4 Incorrect 14 ms 1840 KB Output isn't correct
5 Incorrect 14 ms 1744 KB Output isn't correct
6 Incorrect 14 ms 1740 KB Output isn't correct
7 Incorrect 14 ms 1744 KB Output isn't correct
8 Incorrect 14 ms 1832 KB Output isn't correct
9 Incorrect 38 ms 7436 KB Unexpected end of file - int32 expected
10 Incorrect 37 ms 7624 KB Unexpected end of file - int32 expected
11 Incorrect 44 ms 2644 KB Unexpected end of file - int32 expected
12 Incorrect 59 ms 5200 KB Unexpected end of file - int32 expected
13 Incorrect 83 ms 8272 KB Unexpected end of file - int32 expected
14 Incorrect 143 ms 11500 KB Unexpected end of file - int32 expected
15 Incorrect 156 ms 12784 KB Unexpected end of file - int32 expected
16 Incorrect 203 ms 15616 KB Unexpected end of file - int32 expected
17 Incorrect 235 ms 19816 KB Unexpected end of file - int32 expected
18 Incorrect 244 ms 20508 KB Unexpected end of file - int32 expected
19 Incorrect 283 ms 26920 KB Unexpected end of file - int32 expected
20 Incorrect 242 ms 19724 KB Unexpected end of file - int32 expected