# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
442249 | 2021-07-07T10:41:43 Z | cpp219 | Job Scheduling (CEOI12_jobs) | C++14 | 275 ms | 34316 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 | 28 ms | 24908 KB | Expected EOLN |
2 | Incorrect | 28 ms | 24884 KB | Expected EOLN |
3 | Incorrect | 28 ms | 24892 KB | Expected EOLN |
4 | Incorrect | 28 ms | 24908 KB | Expected EOLN |
5 | Incorrect | 29 ms | 24876 KB | Expected EOLN |
6 | Incorrect | 28 ms | 24908 KB | Expected EOLN |
7 | Incorrect | 28 ms | 24924 KB | Expected EOLN |
8 | Incorrect | 28 ms | 24844 KB | Expected EOLN |
9 | Incorrect | 54 ms | 27916 KB | Expected EOLN |
10 | Incorrect | 52 ms | 27972 KB | Expected EOLN |
11 | Incorrect | 36 ms | 24592 KB | Expected EOLN |
12 | Incorrect | 60 ms | 25284 KB | Expected EOLN |
13 | Incorrect | 86 ms | 26060 KB | Expected EOLN |
14 | Incorrect | 125 ms | 27208 KB | Expected EOLN |
15 | Incorrect | 135 ms | 27744 KB | Expected EOLN |
16 | Incorrect | 179 ms | 28736 KB | Expected EOLN |
17 | Incorrect | 208 ms | 29524 KB | Expected EOLN |
18 | Incorrect | 225 ms | 30368 KB | Expected EOLN |
19 | Runtime error | 275 ms | 34316 KB | Memory limit exceeded |
20 | Incorrect | 224 ms | 29508 KB | Expected EOLN |