제출 #741206

#제출 시각아이디문제언어결과실행 시간메모리
741206bleuJob Scheduling (CEOI12_jobs)C++14
100 / 100
247 ms30064 KiB
#include <bits/stdc++.h> #include <vector> #define pb push_back using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int n, d, m; cin >> n >> d >> m; vector<vector<int>> J(n); for(int i=0; i<m; i++) { int c; cin >> c; J[c-1].pb(i+1); } int lo=0, hi=m; vector<vector<int>> A(n); while(lo < hi) { vector<vector<int>> S(n); int mid = (lo + hi) / 2; int t = 0; bool works=true; for(int i=0; i<n && works; i++) { t=max(t,i); for(auto j : J[i]) { if(S[t].size()>=mid) t++; S[t].pb(j); } if(t-i>d) works=false; } if(works) {hi = mid; A=S;} else lo = mid+1; } cout << lo << "\n"; for(int i=0; i<n; i++) { for(auto j : A[i]) cout << j << " "; cout << "0" << "\n"; } }

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

jobs.cpp: In function 'int main()':
jobs.cpp:32:31: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   32 |                 if(S[t].size()>=mid) t++;
      |                    ~~~~~~~~~~~^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...