Submission #553187

#TimeUsernameProblemLanguageResultExecution timeMemory
553187dyc123Job Scheduling (CEOI12_jobs)C++14
Compilation error
0 ms0 KiB
#include <iostream> #include <vector> #include <utility> using namespace std; #define ii pair<ll, ll> #define ll long long #define fi first #define se second int n, d, m; vector<ii> stX(1000001); vector<int> ans[100001]; bool f(int x) { for(int day=1, j=1; day<=m && j<=n; ++day) for(int i=1; i<=x && j<=n && stX[j].fi<=day; ++i) if (day>stX[j++].fi+d) return 0; return 1; } void trace(int x) { for(int day=1, j=1; day<=m && j<=n; ++day) for(int i=1; i<=x && j<=n && stX[j].fi<=day; ++i) ans[day].push_back(stX[j++].se); } int main() { cin.tie(0) -> sync_with_stdio(0); cout.tie(0); cin >> m >> d >> n; for(int i=1; i<=n; ++i) { cin >> stX[i].fi; stX[i].se=i; } sort(stX.begin()+1, stX.begin()+n+1); int lb=1, rb=n+1, mb; while (lb<rb) { mb=(lb+rb)>>1; if (f(mb)) rb=mb; else lb=mb+1; } trace(lb); cout << lb << '\n'; for(int i=1; i<=m; ++i) { for(int j: ans[i]) cout << j << ' '; cout << "0\n"; } }

Compilation message (stderr)

jobs.cpp: In function 'int main()':
jobs.cpp:39:2: error: 'sort' was not declared in this scope; did you mean 'qsort'?
   39 |  sort(stX.begin()+1, stX.begin()+n+1);
      |  ^~~~
      |  qsort