답안 #384253

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
384253 2021-04-01T01:13:49 Z MalachiN Job Scheduling (CEOI12_jobs) C++14
0 / 100
282 ms 6380 KB
#include <iostream>
#include <fstream>
#include <bits/stdc++.h>
using namespace std;
int N, D, M;
int jobs[10000001];
bool test(int x){
    int tracker = 0;
    for (int n = 1; n <= N; n++){
        int itter = tracker;
        for (int c = itter; c < itter+x; c++){
            if (tracker < M){
                if (jobs[tracker] <= n){
                    if (jobs[tracker]+D < n){
                        return false;
                    }
                    tracker++;
                }
                else {
                    break;
                }
                
            }
            else {
                return true;
            }
  
        }
    }
    return true;
}
int main(int argc, const char * argv[]) {
    //ifstream cin ("file.in"); ofstream cout ("file.out");
 
    cin >> N >> D >> M;
    for (int m = 0; m < M; m++){
        cin >> jobs[m];
    }
    sort(jobs, jobs + M);
    int low = 1;
    int high = 1000000000;
    while (low < high){
        int middle = (low + high)/2;
     //   cout << "High: " << high << " Low: " << low << " Middle: " << middle << endl;
        if (test(middle)){
            if (middle == 1){
       //         cout << "ONE";
            }
            high = middle;
        }
        else {
            low = middle + 1;
        }
        
            
    }
    cout << low;
    

}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 25 ms 1024 KB Unexpected end of file - int32 expected
2 Incorrect 24 ms 1004 KB Unexpected end of file - int32 expected
3 Incorrect 24 ms 1004 KB Unexpected end of file - int32 expected
4 Incorrect 25 ms 1004 KB Unexpected end of file - int32 expected
5 Incorrect 24 ms 1004 KB Unexpected end of file - int32 expected
6 Incorrect 24 ms 1004 KB Unexpected end of file - int32 expected
7 Incorrect 24 ms 1004 KB Unexpected end of file - int32 expected
8 Incorrect 24 ms 1004 KB Unexpected end of file - int32 expected
9 Incorrect 25 ms 1004 KB Unexpected end of file - int32 expected
10 Incorrect 25 ms 1024 KB Unexpected end of file - int32 expected
11 Incorrect 32 ms 1132 KB Unexpected end of file - int32 expected
12 Incorrect 62 ms 1900 KB Unexpected end of file - int32 expected
13 Incorrect 94 ms 2788 KB Unexpected end of file - int32 expected
14 Incorrect 147 ms 3948 KB Unexpected end of file - int32 expected
15 Incorrect 154 ms 4332 KB Unexpected end of file - int32 expected
16 Incorrect 219 ms 5372 KB Unexpected end of file - int32 expected
17 Incorrect 254 ms 5612 KB Unexpected end of file - int32 expected
18 Incorrect 250 ms 5996 KB Unexpected end of file - int32 expected
19 Incorrect 282 ms 6380 KB Unexpected end of file - int32 expected
20 Incorrect 254 ms 5740 KB Unexpected end of file - int32 expected