제출 #418132

#제출 시각아이디문제언어결과실행 시간메모리
418132freshminttJob Scheduling (CEOI12_jobs)C++11
0 / 100
3 ms332 KiB
#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; }

컴파일 시 표준 에러 (stderr) 메시지

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 timeMemoryGrader output
Fetching results...