제출 #580671

#제출 시각아이디문제언어결과실행 시간메모리
580671vqpahmadJob Scheduling (CEOI12_jobs)C++14
40 / 100
271 ms13776 KiB
#include <bits/stdc++.h> #define ll long long #define endl '\n' #define all(a) a.begin(),a.end() #define mod (ll)(10000007) using namespace std; const int mx = 1e6 + 15; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n,d,m; cin >> n >> d >> m; vector<pair<int,int>> a(m); for (int i=0;i<m;i++){ int x; cin >> x; a[i] = {x,i+1}; } sort(all(a)); int s = 0,e=m; int ans = m; while (s<=e){ int mid = (s+e)/2; int i = 0; int day = 1; while (i<m){ int up = upper_bound(all(a),make_pair(day,INT_MAX))-a.begin(); i = min(i+mid,up); day++; if (day==n+1) break; } if (i==m){ ans = mid; e = mid - 1; } else s = mid + 1; } cout << ans << endl; int cur = 0; for (int i=1;i<=n;i++){ int up = upper_bound(all(a),make_pair(i,INT_MAX))-a.begin(); int t = cur+ans; t = min(m,t); for (;cur<t;cur++){ if (a[cur].first>i) break; cout << a[cur].second << ' '; } cout << 0 << endl; } }

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

jobs.cpp: In function 'int main()':
jobs.cpp:45:13: warning: unused variable 'up' [-Wunused-variable]
   45 |         int up = upper_bound(all(a),make_pair(i,INT_MAX))-a.begin();
      |             ^~
#Verdict Execution timeMemoryGrader output
Fetching results...