Submission #869697

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


int main()
{
    long long 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];
        count -= ans;
        if( count < 0 ){ count = 0; }
        if( count > d * ans ){ ans++; }
    }
    cout << ans;
}

Compilation message

jobs.cpp: In function 'int main()':
jobs.cpp:12:21: warning: unused variable 'j' [-Wunused-variable]
   12 |     long long n, i, j, k, l, o, p, m, d, q;
      |                     ^
jobs.cpp:12:27: warning: unused variable 'l' [-Wunused-variable]
   12 |     long long n, i, j, k, l, o, p, m, d, q;
      |                           ^
jobs.cpp:12:30: warning: unused variable 'o' [-Wunused-variable]
   12 |     long long n, i, j, k, l, o, p, m, d, q;
      |                              ^
jobs.cpp:12:33: warning: unused variable 'p' [-Wunused-variable]
   12 |     long long n, i, j, k, l, o, p, m, d, q;
      |                                 ^
jobs.cpp:12:36: warning: unused variable 'm' [-Wunused-variable]
   12 |     long long n, i, j, k, l, o, p, m, d, q;
      |                                    ^
# Verdict Execution time Memory Grader output
1 Incorrect 14 ms 1236 KB Output isn't correct
2 Incorrect 14 ms 1240 KB Output isn't correct
3 Incorrect 14 ms 1236 KB Output isn't correct
4 Incorrect 14 ms 1240 KB Output isn't correct
5 Incorrect 14 ms 1240 KB Output isn't correct
6 Incorrect 15 ms 1292 KB Output isn't correct
7 Incorrect 14 ms 1240 KB Output isn't correct
8 Incorrect 15 ms 1240 KB Output isn't correct
9 Incorrect 15 ms 1496 KB Output isn't correct
10 Incorrect 16 ms 1496 KB Output isn't correct
11 Incorrect 19 ms 1240 KB Output isn't correct
12 Incorrect 38 ms 2060 KB Output isn't correct
13 Incorrect 57 ms 3692 KB Output isn't correct
14 Incorrect 91 ms 3664 KB Output isn't correct
15 Incorrect 99 ms 4040 KB Output isn't correct
16 Incorrect 139 ms 8436 KB Unexpected end of file - int32 expected
17 Incorrect 164 ms 8648 KB Unexpected end of file - int32 expected
18 Incorrect 158 ms 6864 KB Output isn't correct
19 Incorrect 168 ms 7296 KB Output isn't correct
20 Incorrect 160 ms 7880 KB Unexpected end of file - int32 expected