제출 #682025

#제출 시각아이디문제언어결과실행 시간메모리
682025handlenameJob Scheduling (CEOI12_jobs)C++17
0 / 100
4 ms2644 KiB
#include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define float long double const int MOD=1e9+7; //const int MOD=998244353; const int sqn=450; const long double eps=1e-6; int n,d,m; vector<int> arr[100001]; void runtc(){ cin>>n>>d>>m; for (int i=1;i<=m;i++){ int x; cin>>x; arr[x].pb(i); } int mini=0,maxi=1e6; while (mini+1<maxi){ int mid=(mini+maxi)/2; bool can=true; queue<int> q; for (int i=1;i<=n;i++){ for (auto j:arr[i]) q.push(i+d); int num=mid; while (!q.empty() && num>0){ q.pop(); num--; } if (!q.empty() && q.front()<=i) can=false; } if (can) maxi=mid; else mini=mid; } cout<<maxi<<'\n'; queue<int> q; for (int i=1;i<=n;i++){ for (auto j:arr[i]) q.push(j); int num=maxi; while (!q.empty() && num>0){ cout<<q.front()<<' '; q.pop(); num--; } cout<<0<<'\n'; } } int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); //freopen("moocast.in","r",stdin); //freopen("moocast.out","w",stdout); freopen("input1.in","r",stdin); //freopen("output1.out","w",stdout); //freopen("perfectly_balanced_chapter_1_input.txt","r",stdin); //freopen("hackercup_output.txt","w",stdout); int tc; //cin>>tc; tc=1; for (int i=1;i<=tc;i++){ //cout<<"Case #"<<i<<": "; runtc(); } }

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

jobs.cpp: In function 'void runtc()':
jobs.cpp:25:14: warning: unused variable 'j' [-Wunused-variable]
   25 |    for (auto j:arr[i]) q.push(i+d);
      |              ^
jobs.cpp: In function 'int main()':
jobs.cpp:55:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   55 |     freopen("input1.in","r",stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...