제출 #573089

#제출 시각아이디문제언어결과실행 시간메모리
573089updown1Job Scheduling (CEOI12_jobs)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; ll n,d,m; vector<pair<ll,ll>> v; bool ok(ll dd){ ll day = 1; bool works=true; ll w = v.size()-1; while(w>=0){ if(day>n){ works=false; break; } for(ll i = 0; i < dd; i++){ if(w<0){ break; } if(v[w].first+d<day){ works=false; break; } w--; } if(!works){ break; } day++; } return works; } int main(){ cin >> n >> d >> m; for(ll i = 0; i < m; i++){ ll x; cin >> x; v.push_back({x,i}); } sort(v.rbegin(), v.rend()); ll l = 1,r=m; while(l<r){ ll mid = (l+r)/2; if(ok(mid)){ r=mid; } else{ l=mid+1; } } okay(l); ll counter =0 ; cout << l << "\n"; while(!v.empty()){ counter++; for(ll i = 0; i < l; i++){ cout << v.back().second+1 << " "; v.pop_back(); if(v.empty()){ break; } } cout << "0\n"; } for(ll i = 0; i < n-counter; i++){ cout << 0 << "\n"; } }

컴파일 시 표준 에러 (stderr) 메시지

jobs.cpp: In function 'int main()':
jobs.cpp:58:4: error: 'okay' was not declared in this scope; did you mean 'ok'?
   58 |    okay(l);
      |    ^~~~
      |    ok