Submission #78619

#TimeUsernameProblemLanguageResultExecution timeMemory
78619ekremJob Scheduling (CEOI12_jobs)C++98
60 / 100
1089 ms15080 KiB
#include <bits/stdc++.h> #define st first #define nd second #define mp make_pair #define pb push_back #define orta ((bas+son)/2) #define N 1000005 using namespace std; typedef pair < int , int > ii; int n, m, d, bas = 1, son; ii a[N]; bool dene(int x){ queue < int > q; int ind = 1; for(int i = 1; i <= n; i++){ while(a[ind].st == i){ q.push(i); ind++; } int say = 0; for(int j = 1; j <= x; j++) if(!q.empty()){ if(i - q.front() > d) return 0; else q.pop(); } } if(!q.empty()) return 0; return 1; } void bastir(int x){ queue < int > q; int ind = 1; for(int i = 1; i <= n; i++){ while(a[ind].st == i){ q.push(ind); ind++; } int say = 0; for(int j = 1; j <= x; j++) if(!q.empty()){ cout << a[q.front()].nd << " "; q.pop(); } cout << 0 << endl; } } int main() { // freopen("in.txt", "r", stdin); // freopen("out.txt", "w", stdout); scanf("%d %d %d",&n ,&d ,&m); son = m; for(int i = 1; i <= m; i++){ scanf("%d",&a[i].st); a[i].nd = i; } sort(a + 1, a + m + 1); while(bas < son) if(dene(orta)) son = orta; else bas = orta + 1; cout << orta << endl; bastir(orta); return 0; }

Compilation message (stderr)

jobs.cpp: In function 'bool dene(int)':
jobs.cpp:21:7: warning: unused variable 'say' [-Wunused-variable]
   int say = 0;
       ^~~
jobs.cpp: In function 'void bastir(int)':
jobs.cpp:43:7: warning: unused variable 'say' [-Wunused-variable]
   int say = 0;
       ^~~
jobs.cpp: In function 'int main()':
jobs.cpp:56: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:59:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&a[i].st);
   ~~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...