Submission #48413

#TimeUsernameProblemLanguageResultExecution timeMemory
48413updown1Job Scheduling (CEOI12_jobs)C++17
0 / 100
155 ms31308 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define For(i, a, b) for(int i=a; i<b; i++) #define ffi For(i, 0, N) #define ffj For(j, 0, M) #define ffa ffi ffj #define s <<" "<< #define w cout #define e "\n" #define pb push_back #define mp make_pair #define a first #define b second #define int ll const int MAXN=1000000, INF=1000000000000000000; ///500,000,000 int D, N, inp[MAXN]; bool works(int m) { int day = 1; int lef = m; ffi { if (inp[i] > day) day=inp[i], lef = m; if (inp[i] + D < day) return false; lef--; if (lef == 0) day++, lef=m; } return true; } main() { //ifstream cin("test.in"); ios_base::sync_with_stdio(0); cin.tie(0); cin >> N >> D >> N; ffi cin >> inp[i]; sort(inp, inp+N); int a=1, b=N; while (a != b) { int mid = (a+b)/2; if (works(mid)) b = mid; else a = mid+1; } w<< a<<e; }

Compilation message (stderr)

jobs.cpp:32:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main() {
      ^
#Verdict Execution timeMemoryGrader output
Fetching results...