Submission #78543

#TimeUsernameProblemLanguageResultExecution timeMemory
78543hamzqq9Job Scheduling (CEOI12_jobs)C++14
20 / 100
578 ms20736 KiB
#include<bits/stdc++.h> #define st first #define nd second #define pb push_back #define ppb pop_back #define umax(x,y) x=max(x,y) #define umin(x,y) x=min(x,y) #define ll long long #define ii pair<int,int> #define iii pair<ii,int> #define iiii pair<ii,ii> #define sz(x) ((int) x.size()) #define orta ((bas+son)>>1) #define all(x) x.begin(),x.end() #define dbgs(x) cerr<<(#x)<<" --> "<<(x)<<" " #define dbg(x) cerr<<(#x)<<" --> "<<(x)<<endl;getchar() #define pw(x) (1<<(x)) #define inf 2000000000 #define MOD 1000000007 #define N 100005 #define MAX 5000000 #define LOG 100 #define KOK 333 using namespace std; int n,d,m,x; vector<ii> v; void solve(int val) { for(int i=1;i<=n;i++) { int tot=0; while(tot+1<=val && sz(v) && v.back().st<=i) { printf("%d ",v.back().nd); v.ppb(); tot++; } printf("0\n"); } } bool ok(int val) { vector<int> now; for(ii i:v) now.pb(i.st); for(int i=1;i<=n;i++) { int tot=0; while(tot+1<=val && sz(now) && now.back()<=i) { now.ppb(); tot++; } if(sz(now) && i-now.back()>d) return false; } return true; } int main() { //freopen("input.txt","r",stdin); scanf("%d %d %d",&n,&d,&m); for(int i=1;i<=m;i++) { scanf("%d",&x); v.pb({x,i}); } sort(all(v),greater<ii>()); int bas=1,son=m; while(bas<=son) { if(ok(orta)) son=orta-1; else bas=orta+1; } printf("%d\n",bas); solve(bas); }

Compilation message (stderr)

jobs.cpp: In function 'int main()':
jobs.cpp:81:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d %d",&n,&d,&m);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~
jobs.cpp:85:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&x);
   ~~~~~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...