Submission #571029

#TimeUsernameProblemLanguageResultExecution timeMemory
571029elesisJob Scheduling (CEOI12_jobs)C++14
Compilation error
0 ms0 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"; } } 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"; }javascript:tab_clicked(1)

Compilation message (stderr)

jobs.cpp: In function 'int main()':
jobs.cpp:100:12: warning: unused variable 'time_taken' [-Wunused-variable]
  100 |     double time_taken=double(end-start)/double(CLOCKS_PER_SEC);
      |            ^~~~~~~~~~
jobs.cpp: At global scope:
jobs.cpp:102:12: error: found ':' in nested-name-specifier, expected '::'
  102 | }javascript:tab_clicked(1)
      |            ^
      |            ::
jobs.cpp:102:2: error: 'javascript' does not name a type
  102 | }javascript:tab_clicked(1)
      |  ^~~~~~~~~~