Submission #869701

# Submission time Handle Problem Language Result Execution time Memory
869701 2023-11-05T10:56:23 Z Frozenberrys Job Scheduling (CEOI12_jobs) C++17
0 / 100
179 ms 6588 KB
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <set>
using namespace std;


int main()
{
    int n, i, j, k, l, o, p, m, d, q;
    cin >> n >> d >> q;
    int arr[n-d] { 0 };
    vector<int> v;
    for( i = 0; i < q; i++){
        cin >> k;
        v.push_back(k);
        arr[k-1]++;
    }
    sort(v.begin(), v.end());
    int ans;
    if(q%(n-d)==0){ ans = q/(n-d); } else { ans = q/(n-d)+1; }
    int count = 0; // first processed
    for( i = 0; i < n-d; i++){
        count += arr[i];
        if( count > d * ans ){ ans += count - d * ans; }
        count -= ans;
    }
    cout << ans;
}

Compilation message

jobs.cpp: In function 'int main()':
jobs.cpp:12:15: warning: unused variable 'j' [-Wunused-variable]
   12 |     int n, i, j, k, l, o, p, m, d, q;
      |               ^
jobs.cpp:12:21: warning: unused variable 'l' [-Wunused-variable]
   12 |     int n, i, j, k, l, o, p, m, d, q;
      |                     ^
jobs.cpp:12:24: warning: unused variable 'o' [-Wunused-variable]
   12 |     int n, i, j, k, l, o, p, m, d, q;
      |                        ^
jobs.cpp:12:27: warning: unused variable 'p' [-Wunused-variable]
   12 |     int n, i, j, k, l, o, p, m, d, q;
      |                           ^
jobs.cpp:12:30: warning: unused variable 'm' [-Wunused-variable]
   12 |     int n, i, j, k, l, o, p, m, d, q;
      |                              ^
# Verdict Execution time Memory Grader output
1 Incorrect 15 ms 980 KB Output isn't correct
2 Incorrect 14 ms 984 KB Output isn't correct
3 Incorrect 15 ms 984 KB Output isn't correct
4 Incorrect 14 ms 984 KB Output isn't correct
5 Incorrect 14 ms 984 KB Output isn't correct
6 Incorrect 15 ms 980 KB Output isn't correct
7 Incorrect 15 ms 984 KB Output isn't correct
8 Incorrect 14 ms 984 KB Output isn't correct
9 Incorrect 19 ms 1240 KB Output isn't correct
10 Incorrect 16 ms 1348 KB Output isn't correct
11 Incorrect 19 ms 984 KB Output isn't correct
12 Incorrect 38 ms 1492 KB Output isn't correct
13 Incorrect 57 ms 2540 KB Output isn't correct
14 Incorrect 98 ms 2504 KB Output isn't correct
15 Incorrect 96 ms 2504 KB Output isn't correct
16 Incorrect 140 ms 6224 KB Unexpected end of file - int32 expected
17 Incorrect 179 ms 5144 KB Unexpected end of file - int32 expected
18 Incorrect 152 ms 6172 KB Output isn't correct
19 Incorrect 170 ms 6588 KB Output isn't correct
20 Incorrect 165 ms 6580 KB Unexpected end of file - int32 expected