Submission #78620

#TimeUsernameProblemLanguageResultExecution timeMemory
78620ekremJob Scheduling (CEOI12_jobs)C++98
50 / 100
1085 ms11196 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, q[N], l, r; ii a[N]; bool dene(int x){ l = 1; r = 0; int ind = 1; for(int i = 1; i <= n; i++){ while(a[ind].st == i){ q[++r] = i; ind++; } int say = 0; for(int j = 1; j <= x; j++) if(r - l + 1 > 0){ if(i - q[l] > d) return 0; else l++; } } if(r - l + 1 > 0) return 0; return 1; } void bastir(int x){ l = 1; r = 0; int ind = 1; for(int i = 1; i <= n; i++){ while(a[ind].st == i){ q[++r] = ind; ind++; } int say = 0; for(int j = 1; j <= x; j++) if(r - l + 1 > 0){ cout << a[q[l]].nd << " "; l++; } 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:22:7: warning: unused variable 'say' [-Wunused-variable]
   int say = 0;
       ^~~
jobs.cpp: In function 'void bastir(int)':
jobs.cpp:45:7: warning: unused variable 'say' [-Wunused-variable]
   int say = 0;
       ^~~
jobs.cpp: In function 'int main()':
jobs.cpp:58: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:61: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...