Submission #418132

# Submission time Handle Problem Language Result Execution time Memory
418132 2021-06-05T06:51:07 Z freshmintt Job Scheduling (CEOI12_jobs) C++11
0 / 100
3 ms 332 KB
#include<bits/stdc++.h>
#define MAXN 10 //change
using namespace std;
typedef pair<long long,long long> pi;
typedef long long ll;
typedef long double ld;
ll N, D, M;

#define FIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
 
ll jobs[MAXN];
ll days[MAXN];

bool works(ll machs) {
  fill(days, days+MAXN, 0);
  for (int i=0; i < N; i++) {
    ll machID = i % machs;
    days[machID]++;
    if ((days[machID] - jobs[i]) > D) return false;
  }
  return true;
}

int main() { 
  freopen("in", "r", stdin); // comment out
  FIO;
  cin >> N >> D >> M;

  
  for (int i = 0; i < N; i ++) cin >> jobs[i];

  ll a = 1; ll b = 1E9; ll mid;
  while (a != b) {
    mid = (a+b)/2;
    if (works(mid)) {
      b = mid;
    }
    else {
      a = mid + 1;
    }
  }

  cout << mid;



}   

Compilation message

jobs.cpp: In function 'int main()':
jobs.cpp:25:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   25 |   freopen("in", "r", stdin); // comment out
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 332 KB Output isn't correct
2 Incorrect 2 ms 332 KB Output isn't correct
3 Incorrect 2 ms 332 KB Output isn't correct
4 Incorrect 2 ms 332 KB Output isn't correct
5 Incorrect 2 ms 332 KB Output isn't correct
6 Incorrect 2 ms 332 KB Output isn't correct
7 Incorrect 2 ms 332 KB Output isn't correct
8 Incorrect 2 ms 332 KB Output isn't correct
9 Incorrect 2 ms 332 KB Output isn't correct
10 Incorrect 2 ms 332 KB Output isn't correct
11 Incorrect 2 ms 332 KB Output isn't correct
12 Incorrect 2 ms 332 KB Output isn't correct
13 Incorrect 2 ms 332 KB Output isn't correct
14 Incorrect 2 ms 332 KB Output isn't correct
15 Incorrect 2 ms 332 KB Output isn't correct
16 Incorrect 2 ms 332 KB Output isn't correct
17 Incorrect 2 ms 332 KB Output isn't correct
18 Incorrect 2 ms 332 KB Output isn't correct
19 Incorrect 2 ms 332 KB Output isn't correct
20 Incorrect 2 ms 332 KB Output isn't correct