# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
442246 | 2021-07-07T10:38:37 Z | cpp219 | Job Scheduling (CEOI12_jobs) | C++14 | 453 ms | 44484 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 | 42 ms | 25852 KB | Expected EOLN |
2 | Incorrect | 41 ms | 25884 KB | Expected EOLN |
3 | Incorrect | 70 ms | 25836 KB | Expected EOLN |
4 | Incorrect | 41 ms | 25872 KB | Expected EOLN |
5 | Incorrect | 41 ms | 25920 KB | Expected EOLN |
6 | Incorrect | 41 ms | 25840 KB | Expected EOLN |
7 | Incorrect | 41 ms | 25856 KB | Expected EOLN |
8 | Incorrect | 43 ms | 25828 KB | Expected EOLN |
9 | Incorrect | 72 ms | 29124 KB | Expected EOLN |
10 | Incorrect | 70 ms | 29120 KB | Expected EOLN |
11 | Incorrect | 52 ms | 25600 KB | Expected EOLN |
12 | Incorrect | 89 ms | 27572 KB | Expected EOLN |
13 | Incorrect | 148 ms | 30164 KB | Expected EOLN |
14 | Incorrect | 183 ms | 32276 KB | Expected EOLN |
15 | Runtime error | 207 ms | 33984 KB | Memory limit exceeded |
16 | Runtime error | 282 ms | 36072 KB | Memory limit exceeded |
17 | Runtime error | 320 ms | 39620 KB | Memory limit exceeded |
18 | Runtime error | 386 ms | 39876 KB | Memory limit exceeded |
19 | Runtime error | 453 ms | 44484 KB | Memory limit exceeded |
20 | Runtime error | 338 ms | 39500 KB | Memory limit exceeded |