# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
696748 | koolaider | Job Scheduling (CEOI12_jobs) | C++17 | 1084 ms | 19416 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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(m);// val, index
int x;
for(int i = 0; i<m; i++){
cin >> x; v[i]={x, i+1};
}
sort(v.begin(), v.end()); debug(v);
int l=0, r=n-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){
ans=min(ans, mid);
r=mid-1;
}
}
cout << ans << endl; int counter = 0;
for(int i = 0; i<m; i++){
cout << v[i].second << " ";
counter++;
if(counter==ans){
cout << 0; cout << endl; counter=0;
}
}
if(n>m/ans){
for(int i = 0; i<n-m/ans; i++){
cout << 0 << endl;
}
}
return 0;
}
/*
8 2 12
1 2 4 2 1 3 5 6 2 3 6 4
*/
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |