제출 #710753

#제출 시각아이디문제언어결과실행 시간메모리
710753Spade1Job Scheduling (CEOI12_jobs)C++14
100 / 100
88 ms7824 KiB
#include<bits/stdc++.h> #define pii pair<int, int> #define ll long long #define INF 2e9 #define nd second #define st first #define pb push_back using namespace std; const int N = 1e5 + 10; int cnt[N], idx[N]; vector<int> W[N]; void solve() { int n, d, m; cin >> n >> d >> m; for (int i = 1; i <= m; ++i) { int j; cin >> j; cnt[j]++; W[j].pb(i); } int l = 1, r = 1e6; while (l < r) { int mid = (l+r)/2; bool no = 0; deque<pii> dq; for (int i = 1; i <= n; ++i) { dq.push_back({cnt[i], i}); int cur = 0; while (!dq.empty() && cur < mid) { if (i - dq.front().nd > d) { no = 1; break; } if (dq.front().st + cur > mid) { auto [w, i] = dq.front(); dq.pop_front(); dq.push_front({w-mid+cur, i}); cur = mid; } else { cur += dq.front().st; dq.pop_front(); } } if (no) break; } if (no) l = mid+1; else r = mid; } cout << l << '\n'; deque<pii> dq; for (int i = 1; i <= n; ++i) { cout << 0 << '\n'; } } int main() { ios_base::sync_with_stdio(0); cin.tie(0); int t = 1; // cin >> t; while (t--) { solve(); } return 0; }

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

jobs.cpp: In function 'void solve()':
jobs.cpp:36:26: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   36 |                     auto [w, i] = dq.front();
      |                          ^
#Verdict Execution timeMemoryGrader output
Fetching results...