# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
696753 | koolaider | Job Scheduling (CEOI12_jobs) | C++17 | 323 ms | 13900 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include <cstdlib>
using namespace std;
void setIO(string s) {
freopen((s + ".in").c_str(), "r", stdin);
freopen((s + ".out").c_str(), "w", stdout);
}
#define watch(x) cerr << "\n" << (#x) << " is " << (x) << endl
#define pb push_back
#define ll long long
#define cint const int
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
//binar, dp, starcod, coci, / bfs, /seg
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
#pragma GCC target ("avx,avx2")
#pragma GCC optimize ("O3")
const long long ML = 1e18;
cint MN = 1e9;
cint MA = 2e5+1;
cint MM = 1e9+7;
int main(int argc, char **argv){
ios_base::sync_with_stdio(false); cin.tie(NULL), cout.tie(NULL);
int n, d, m; cin >> n >> d >> m; vector<pair<int, int>> v; int x;
for(int i = 0; i<m; i++){
cin >> x; v.pb({x, i+1});
}
sort(v.begin(), v.end()); //debug(v);
int l=1, r=m-1; int ans = MN;
while(l<=r){
int mid=(l+r)/2;
int curr=m-(n*mid);
if(curr>0){
l=mid+1;
}else if(curr<=0){
int currDay=0; int Clock=0; bool isOk=true;
for(int i = 0; i<m; i++){
if(v[i].first+d<currDay){
isOk=false; break;
}
Clock++;
if(Clock==mid){
currDay++; Clock=0;
}
}
if(isOk==true){
ans=min(ans, mid);
}
r=mid-1;
}
}
cout << ans << endl; int outputCounter=0;
for(int i = 0; i<m; i++){
cout << v[i].second << " ";
outputCounter++;
if(outputCounter==ans){
cout << 0 << endl; outputCounter=0;
}
}
for(int i = 0; i<n-ceil(m/ans); i++){
cout << 0 << endl;
}
return 0;
}
/*
8 2 12
1 2 4 2 1 3 5 6 2 3 6 4
*/
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |