# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
442248 | 2021-07-07T10:40:48 Z | cpp219 | Job Scheduling (CEOI12_jobs) | C++14 | 279 ms | 30936 KB |
#pragma GCC optimization O2 #pragma GCC optimization "unroll-loop" #pragma target ("avx2") #include <bits/stdc++.h> #define ll int #define ld long double #define fs first #define sc second using namespace std; typedef pair<ll,ll> LL; const ll N = 1e6 + 9; const ll Log2 = 20; const ll inf = 1e9 + 7; ll n,m,d,a[N],pos[N]; bool lf(ll x,ll y){ return a[x] < a[y]; } vector<ll> ans[N]; bool chk(ll mid){ ll cur = 1; for (ll day = 1;day <= n;day++){ ll have = mid; ans[day].clear(); while(have > 0 && cur <= m&&a[pos[cur]] <= day){ if (day - a[pos[cur]] > d) return 0; //ans[day].push_back(pos[cur]); cur++; have--; } //ans[day].push_back(0); } return 1; } int main(){ ios_base::sync_with_stdio(NULL); cin.tie(0); cout.tie(0); #define task "test" if (fopen(task".INP","r")){ freopen(task".INP","r",stdin); //freopen(task".OUT","w",stdout); } cin>>n>>d>>m; for (ll i = 1;i <= m;i++) cin>>a[i],pos[i] = i; sort(pos + 1,pos + m + 1,lf); ll l,mid,h; l = 1; h = m; //cout<<chk(2); return 0; while(l <= h){ mid = (l + h)/2; if (chk(mid)) h = mid - 1; else l = mid + 1; } cout<<l<<"\n"; chk(l); //return 0; for (ll i = 1;i <= n;i++){ for (auto j : ans[i]) cout<<j<<" "; cout<<"\n"; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 27 ms | 24524 KB | Unexpected end of file - int32 expected |
2 | Incorrect | 27 ms | 24524 KB | Unexpected end of file - int32 expected |
3 | Incorrect | 28 ms | 24600 KB | Unexpected end of file - int32 expected |
4 | Incorrect | 27 ms | 24512 KB | Unexpected end of file - int32 expected |
5 | Incorrect | 30 ms | 24652 KB | Unexpected end of file - int32 expected |
6 | Incorrect | 27 ms | 24556 KB | Unexpected end of file - int32 expected |
7 | Incorrect | 27 ms | 24536 KB | Unexpected end of file - int32 expected |
8 | Incorrect | 28 ms | 24584 KB | Unexpected end of file - int32 expected |
9 | Incorrect | 35 ms | 24600 KB | Unexpected end of file - int32 expected |
10 | Incorrect | 36 ms | 24652 KB | Unexpected end of file - int32 expected |
11 | Incorrect | 36 ms | 24544 KB | Unexpected end of file - int32 expected |
12 | Incorrect | 59 ms | 25360 KB | Unexpected end of file - int32 expected |
13 | Incorrect | 84 ms | 26144 KB | Unexpected end of file - int32 expected |
14 | Incorrect | 137 ms | 26820 KB | Unexpected end of file - int32 expected |
15 | Incorrect | 135 ms | 27668 KB | Unexpected end of file - int32 expected |
16 | Incorrect | 179 ms | 28416 KB | Unexpected end of file - int32 expected |
17 | Incorrect | 213 ms | 29276 KB | Unexpected end of file - int32 expected |
18 | Incorrect | 263 ms | 30068 KB | Unexpected end of file - int32 expected |
19 | Incorrect | 279 ms | 30936 KB | Unexpected end of file - int32 expected |
20 | Incorrect | 231 ms | 29272 KB | Unexpected end of file - int32 expected |