Submission #993417

#TimeUsernameProblemLanguageResultExecution timeMemory
993417lacitoRobots (IOI13_robots)C++14
14 / 100
182 ms24008 KiB
#include "robots.h" #include <bits/stdc++.h> using namespace std; const int Max = 1e6 + 5; const int M = 5e4 + 5; typedef long long ll; vector<pair<ll,ll>> v; ll a[M], b[M]; int siza, sizb; bool sol(ll mid) { ll cnt = 0; int indx = siza-1; // cout << mid << 'p' << endl; for(int i = v.size()-1; i >= 0; i--) { // cout << v[i].first << ' ' << i << ' ' << indx << ' ' << a[indx] << 'o' << endl; if(indx < 0) return false; if(v[i].first >= a[indx]) { return false; } else { cnt++; // cout << cnt << 'i' << endl; if(cnt == mid) { cnt = 0; indx--; } } } //cout << 'Y' << endl; return true; } int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) { for(int i = 0; i < A; i++) a[i] = X[i]; for(int i = 0; i < B; i++) b[i] = Y[i]; siza = A; sizb = B; sort(a,a+A); sort(b,b+B); for(int i = 0; i < T; i++) { v.push_back({W[i],0}); } sort(v.begin(),v.end()); ll l = 0, r = 10000000000; ll ans = -1; while(l + 1 < r) { ll mid = (l+r)/2; if(sol(mid) == true) { r = mid; ans = mid; } else { l = mid; } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...