제출 #571028

#제출 시각아이디문제언어결과실행 시간메모리
571028elesisJob Scheduling (CEOI12_jobs)C++14
80 / 100
479 ms48808 KiB
#include<bits/stdc++.h> using namespace std; #define fast ios_base::sync_with_stdio(false);cin.tie(0); #define int long long #define pii pair<int,int> #define ff first #define ss second const int inf=1e11+7; const int mod =1000000007; int binpow(int a,int b,int m) { a %= m; int res = 1; while(b>0) { if (b&1) { res=res*a%m; } a=a*a%m; b>>=1; } return res; } int N,M,D; pair<bool, vector<vector <int>>> ok(vector<pii> &arr, int x) { vector <vector <int>> nub(N); int job=0; for(int i=1;i<=N;i++) { for(int j=0;j<x;j++) { if(arr[job].ff>i) { break; } if(arr[job].ff+D>=i) { nub[i-1].push_back(arr[job].ss); job++; } else { return {false,nub}; } if(job==M) { return {true,nub}; } } } return {false,nub}; } void solve() { cin>>N>>D>>M; int ans; vector <pii> arr(M); for(int i=0;i<M;i++) { cin>>arr[i].first; arr[i].second=i+1; } sort(arr.begin(),arr.end()); vector <vector <int>> res; int lo=1,hi=M; while(lo<hi) { int mid=(lo+hi)/2; pair <bool,vector <vector <int>>> ef=ok(arr,mid); if(ef.ff) { ans=mid; res=ef.ss; hi=mid; } else { lo=mid+1; } } cout << ans << "\n"; for(int i=0;i<N;i++) { for(auto it:res[i]) { cout << it << " " ; } cout << 0 << "\n"; } if(ok(arr,1).ff) { cout << "wtf" << '\n'; } } signed main() { fast clock_t start, end; start = clock(); solve(); end = clock(); double time_taken=double(end-start)/double(CLOCKS_PER_SEC); //cout << "time taken" << " " << time_taken << "\n"; }

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

jobs.cpp: In function 'int main()':
jobs.cpp:104:12: warning: unused variable 'time_taken' [-Wunused-variable]
  104 |     double time_taken=double(end-start)/double(CLOCKS_PER_SEC);
      |            ^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...