Submission #869697

#TimeUsernameProblemLanguageResultExecution timeMemory
869697FrozenberrysJob Scheduling (CEOI12_jobs)C++17
0 / 100
168 ms8648 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...