제출 #1085652

#제출 시각아이디문제언어결과실행 시간메모리
1085652vjudge1Job Scheduling (CEOI12_jobs)C++17
100 / 100
191 ms31508 KiB
#include <bits/stdc++.h> using namespace std; long long n,d,m; long long freq[100001]; vector<long long> v; long long kec=1,nula=0; bool moze(long long k) { long long rabota = nula; for (long long i=0;i<=n;i++) { rabota += freq[i]; long long koga_gotovo = rabota/k; if (rabota%k>0) koga_gotovo++; if (koga_gotovo>d+1) return false; if (rabota<k) rabota=nula; else rabota-=k; } if (rabota>nula) return false; return true; } long long bs(long long l,long long r) { if (l==r) return l; long long mid = (l+r)/2; if (moze(mid)) return bs(l,mid); return bs(mid+1,r); } void pecati(long long k) { vector<pair<long long,long long> > t; for (long long i=0;i<m;i++) t.push_back({v[i],i+1}); sort(t.begin(),t.end()); long long p=0; for (long long i=1;i<=n;i++) { for (long long j=0;j<k;j++) { if (p==t.size() || t[p].first>i) break; cout<<t[p].second<<" "; p++; } cout<<0<<"\n"; } } int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin>>n>>d>>m; for (long long i=0;i<m;i++) { long long a; cin>>a; freq[a]++; v.push_back(a); } long long odg = bs(kec,m); cout<<odg<<"\n"; pecati(odg); return 0; }

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

jobs.cpp: In function 'void pecati(long long int)':
jobs.cpp:47:18: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   47 |             if (p==t.size() || t[p].first>i) break;
      |                 ~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...